ent

package
v0.0.7-alpha Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 27 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.
	TypeComment    = "Comment"
	TypeFile       = "File"
	TypePage       = "Page"
	TypePermission = "Permission"
	TypePost       = "Post"
	TypeRole       = "Role"
	TypeSetting    = "Setting"
	TypeTopic      = "Topic"
	TypeUser       = "User"
)

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 AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Comment is the client for interacting with the Comment builders.
	Comment *CommentClient
	// File is the client for interacting with the File builders.
	File *FileClient
	// Page is the client for interacting with the Page builders.
	Page *PageClient
	// Permission is the client for interacting with the Permission builders.
	Permission *PermissionClient
	// Post is the client for interacting with the Post builders.
	Post *PostClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// Setting is the client for interacting with the Setting builders.
	Setting *SettingClient
	// Topic is the client for interacting with the Topic builders.
	Topic *TopicClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.

func (*Client) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	Comment.
	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 Comment

type Comment struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt time.Time `json:"omitempty"`
	// Content holds the value of the "content" field.
	Content string `json:"content,omitempty" validate:"required"`
	// ContentHTML holds the value of the "content_html" field.
	ContentHTML string `json:"content_html,omitempty" validate:"required"`
	// Votes holds the value of the "votes" field.
	Votes int64 `json:"votes,omitempty"`
	// PostID holds the value of the "post_id" field.
	PostID int `json:"post_id,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID int `json:"user_id,omitempty"`
	// ParentID holds the value of the "parent_id" field.
	ParentID int `json:"parent_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the CommentQuery when eager-loading is set.
	Edges CommentEdges `json:"edges"`
	// contains filtered or unexported fields
}

Comment is the model entity for the Comment schema.

func (*Comment) QueryChildren

func (c *Comment) QueryChildren() *CommentQuery

QueryChildren queries the "children" edge of the Comment entity.

func (*Comment) QueryParent

func (c *Comment) QueryParent() *CommentQuery

QueryParent queries the "parent" edge of the Comment entity.

func (*Comment) QueryPost

func (c *Comment) QueryPost() *PostQuery

QueryPost queries the "post" edge of the Comment entity.

func (*Comment) QueryUser

func (c *Comment) QueryUser() *UserQuery

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

func (*Comment) String

func (c *Comment) String() string

String implements the fmt.Stringer.

func (*Comment) Unwrap

func (c *Comment) Unwrap() *Comment

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

func (c *Comment) Update() *CommentUpdateOne

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

type CommentClient

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

CommentClient is a client for the Comment schema.

func NewCommentClient

func NewCommentClient(c config) *CommentClient

NewCommentClient returns a client for the Comment from the given config.

func (*CommentClient) Create

func (c *CommentClient) Create() *CommentCreate

Create returns a create builder for Comment.

func (*CommentClient) CreateBulk

func (c *CommentClient) CreateBulk(builders ...*CommentCreate) *CommentCreateBulk

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

func (*CommentClient) Delete

func (c *CommentClient) Delete() *CommentDelete

Delete returns a delete builder for Comment.

func (*CommentClient) DeleteOne

func (c *CommentClient) DeleteOne(co *Comment) *CommentDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*CommentClient) DeleteOneID

func (c *CommentClient) DeleteOneID(id int) *CommentDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*CommentClient) Get

func (c *CommentClient) Get(ctx context.Context, id int) (*Comment, error)

Get returns a Comment entity by its id.

func (*CommentClient) GetX

func (c *CommentClient) GetX(ctx context.Context, id int) *Comment

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

func (*CommentClient) Hooks

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

Hooks returns the client hooks.

func (*CommentClient) Query

func (c *CommentClient) Query() *CommentQuery

Query returns a query builder for Comment.

func (*CommentClient) QueryChildren

func (c *CommentClient) QueryChildren(co *Comment) *CommentQuery

QueryChildren queries the children edge of a Comment.

func (*CommentClient) QueryParent

func (c *CommentClient) QueryParent(co *Comment) *CommentQuery

QueryParent queries the parent edge of a Comment.

func (*CommentClient) QueryPost

func (c *CommentClient) QueryPost(co *Comment) *PostQuery

QueryPost queries the post edge of a Comment.

func (*CommentClient) QueryUser

func (c *CommentClient) QueryUser(co *Comment) *UserQuery

QueryUser queries the user edge of a Comment.

func (*CommentClient) Update

func (c *CommentClient) Update() *CommentUpdate

Update returns an update builder for Comment.

func (*CommentClient) UpdateOne

func (c *CommentClient) UpdateOne(co *Comment) *CommentUpdateOne

UpdateOne returns an update builder for the given entity.

func (*CommentClient) UpdateOneID

func (c *CommentClient) UpdateOneID(id int) *CommentUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CommentClient) Use

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

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

type CommentCreate

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

CommentCreate is the builder for creating a Comment entity.

func (*CommentCreate) AddChildIDs

func (cc *CommentCreate) AddChildIDs(ids ...int) *CommentCreate

AddChildIDs adds the "children" edge to the Comment entity by IDs.

func (*CommentCreate) AddChildren

func (cc *CommentCreate) AddChildren(c ...*Comment) *CommentCreate

AddChildren adds the "children" edges to the Comment entity.

func (*CommentCreate) Exec

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

Exec executes the query.

func (*CommentCreate) ExecX

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

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

func (*CommentCreate) Mutation

func (cc *CommentCreate) Mutation() *CommentMutation

Mutation returns the CommentMutation object of the builder.

func (*CommentCreate) OnConflict

func (cc *CommentCreate) OnConflict(opts ...sql.ConflictOption) *CommentUpsertOne

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

client.Comment.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.CommentUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*CommentCreate) OnConflictColumns

func (cc *CommentCreate) OnConflictColumns(columns ...string) *CommentUpsertOne

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

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

func (*CommentCreate) Save

func (cc *CommentCreate) Save(ctx context.Context) (*Comment, error)

Save creates the Comment in the database.

func (*CommentCreate) SaveX

func (cc *CommentCreate) SaveX(ctx context.Context) *Comment

SaveX calls Save and panics if Save returns an error.

func (*CommentCreate) SetContent

func (cc *CommentCreate) SetContent(s string) *CommentCreate

SetContent sets the "content" field.

func (*CommentCreate) SetContentHTML

func (cc *CommentCreate) SetContentHTML(s string) *CommentCreate

SetContentHTML sets the "content_html" field.

func (*CommentCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CommentCreate) SetDeletedAt

func (cc *CommentCreate) SetDeletedAt(t time.Time) *CommentCreate

SetDeletedAt sets the "deleted_at" field.

func (*CommentCreate) SetNillableCreatedAt

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

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

func (*CommentCreate) SetNillableDeletedAt

func (cc *CommentCreate) SetNillableDeletedAt(t *time.Time) *CommentCreate

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

func (*CommentCreate) SetNillableParentID

func (cc *CommentCreate) SetNillableParentID(i *int) *CommentCreate

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*CommentCreate) SetNillablePostID

func (cc *CommentCreate) SetNillablePostID(i *int) *CommentCreate

SetNillablePostID sets the "post_id" field if the given value is not nil.

func (*CommentCreate) SetNillableUpdatedAt

func (cc *CommentCreate) SetNillableUpdatedAt(t *time.Time) *CommentCreate

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

func (*CommentCreate) SetNillableUserID

func (cc *CommentCreate) SetNillableUserID(i *int) *CommentCreate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*CommentCreate) SetNillableVotes

func (cc *CommentCreate) SetNillableVotes(i *int64) *CommentCreate

SetNillableVotes sets the "votes" field if the given value is not nil.

func (*CommentCreate) SetParent

func (cc *CommentCreate) SetParent(c *Comment) *CommentCreate

SetParent sets the "parent" edge to the Comment entity.

func (*CommentCreate) SetParentID

func (cc *CommentCreate) SetParentID(i int) *CommentCreate

SetParentID sets the "parent_id" field.

func (*CommentCreate) SetPost

func (cc *CommentCreate) SetPost(p *Post) *CommentCreate

SetPost sets the "post" edge to the Post entity.

func (*CommentCreate) SetPostID

func (cc *CommentCreate) SetPostID(i int) *CommentCreate

SetPostID sets the "post_id" field.

func (*CommentCreate) SetUpdatedAt

func (cc *CommentCreate) SetUpdatedAt(t time.Time) *CommentCreate

SetUpdatedAt sets the "updated_at" field.

func (*CommentCreate) SetUser

func (cc *CommentCreate) SetUser(u *User) *CommentCreate

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

func (*CommentCreate) SetUserID

func (cc *CommentCreate) SetUserID(i int) *CommentCreate

SetUserID sets the "user_id" field.

func (*CommentCreate) SetVotes

func (cc *CommentCreate) SetVotes(i int64) *CommentCreate

SetVotes sets the "votes" field.

type CommentCreateBulk

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

CommentCreateBulk is the builder for creating many Comment entities in bulk.

func (*CommentCreateBulk) Exec

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

Exec executes the query.

func (*CommentCreateBulk) ExecX

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

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

func (*CommentCreateBulk) OnConflict

func (ccb *CommentCreateBulk) OnConflict(opts ...sql.ConflictOption) *CommentUpsertBulk

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

client.Comment.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.CommentUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*CommentCreateBulk) OnConflictColumns

func (ccb *CommentCreateBulk) OnConflictColumns(columns ...string) *CommentUpsertBulk

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

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

func (*CommentCreateBulk) Save

func (ccb *CommentCreateBulk) Save(ctx context.Context) ([]*Comment, error)

Save creates the Comment entities in the database.

func (*CommentCreateBulk) SaveX

func (ccb *CommentCreateBulk) SaveX(ctx context.Context) []*Comment

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

type CommentDelete

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

CommentDelete is the builder for deleting a Comment entity.

func (*CommentDelete) Exec

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

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

func (*CommentDelete) ExecX

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

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

func (*CommentDelete) Where

func (cd *CommentDelete) Where(ps ...predicate.Comment) *CommentDelete

Where appends a list predicates to the CommentDelete builder.

type CommentDeleteOne

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

CommentDeleteOne is the builder for deleting a single Comment entity.

func (*CommentDeleteOne) Exec

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

Exec executes the deletion query.

func (*CommentDeleteOne) ExecX

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

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

type CommentEdges

type CommentEdges struct {
	// Post holds the value of the post edge.
	Post *Post `json:"post,omitempty"`
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Children holds the value of the children edge.
	Children []*Comment `json:"children,omitempty"`
	// Parent holds the value of the parent edge.
	Parent *Comment `json:"parent,omitempty"`
	// contains filtered or unexported fields
}

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

func (CommentEdges) ChildrenOrErr

func (e CommentEdges) ChildrenOrErr() ([]*Comment, error)

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

func (CommentEdges) ParentOrErr

func (e CommentEdges) ParentOrErr() (*Comment, error)

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

func (CommentEdges) PostOrErr

func (e CommentEdges) 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.

func (CommentEdges) UserOrErr

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

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

type CommentFilter

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

CommentFilter provides a generic filtering capability at runtime for CommentQuery.

func (*CommentFilter) Where

func (f *CommentFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*CommentFilter) WhereContent

func (f *CommentFilter) WhereContent(p entql.StringP)

WhereContent applies the entql string predicate on the content field.

func (*CommentFilter) WhereContentHTML

func (f *CommentFilter) WhereContentHTML(p entql.StringP)

WhereContentHTML applies the entql string predicate on the content_html field.

func (*CommentFilter) WhereCreatedAt

func (f *CommentFilter) WhereCreatedAt(p entql.TimeP)

WhereCreatedAt applies the entql time.Time predicate on the created_at field.

func (*CommentFilter) WhereDeletedAt

func (f *CommentFilter) WhereDeletedAt(p entql.TimeP)

WhereDeletedAt applies the entql time.Time predicate on the deleted_at field.

func (*CommentFilter) WhereHasChildren

func (f *CommentFilter) WhereHasChildren()

WhereHasChildren applies a predicate to check if query has an edge children.

func (*CommentFilter) WhereHasChildrenWith

func (f *CommentFilter) WhereHasChildrenWith(preds ...predicate.Comment)

WhereHasChildrenWith applies a predicate to check if query has an edge children with a given conditions (other predicates).

func (*CommentFilter) WhereHasParent

func (f *CommentFilter) WhereHasParent()

WhereHasParent applies a predicate to check if query has an edge parent.

func (*CommentFilter) WhereHasParentWith

func (f *CommentFilter) WhereHasParentWith(preds ...predicate.Comment)

WhereHasParentWith applies a predicate to check if query has an edge parent with a given conditions (other predicates).

func (*CommentFilter) WhereHasPost

func (f *CommentFilter) WhereHasPost()

WhereHasPost applies a predicate to check if query has an edge post.

func (*CommentFilter) WhereHasPostWith

func (f *CommentFilter) WhereHasPostWith(preds ...predicate.Post)

WhereHasPostWith applies a predicate to check if query has an edge post with a given conditions (other predicates).

func (*CommentFilter) WhereHasUser

func (f *CommentFilter) WhereHasUser()

WhereHasUser applies a predicate to check if query has an edge user.

func (*CommentFilter) WhereHasUserWith

func (f *CommentFilter) WhereHasUserWith(preds ...predicate.User)

WhereHasUserWith applies a predicate to check if query has an edge user with a given conditions (other predicates).

func (*CommentFilter) WhereID

func (f *CommentFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*CommentFilter) WhereParentID

func (f *CommentFilter) WhereParentID(p entql.IntP)

WhereParentID applies the entql int predicate on the parent_id field.

func (*CommentFilter) WherePostID

func (f *CommentFilter) WherePostID(p entql.IntP)

WherePostID applies the entql int predicate on the post_id field.

func (*CommentFilter) WhereUpdatedAt

func (f *CommentFilter) WhereUpdatedAt(p entql.TimeP)

WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.

func (*CommentFilter) WhereUserID

func (f *CommentFilter) WhereUserID(p entql.IntP)

WhereUserID applies the entql int predicate on the user_id field.

func (*CommentFilter) WhereVotes

func (f *CommentFilter) WhereVotes(p entql.Int64P)

WhereVotes applies the entql int64 predicate on the votes field.

type CommentGroupBy

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

CommentGroupBy is the group-by builder for Comment entities.

func (*CommentGroupBy) Aggregate

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

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

func (*CommentGroupBy) Bool

func (cgb *CommentGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) BoolX

func (cgb *CommentGroupBy) BoolX(ctx context.Context) bool

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

func (*CommentGroupBy) Bools

func (cgb *CommentGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) BoolsX

func (cgb *CommentGroupBy) BoolsX(ctx context.Context) []bool

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

func (*CommentGroupBy) Float64

func (cgb *CommentGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) Float64X

func (cgb *CommentGroupBy) Float64X(ctx context.Context) float64

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

func (*CommentGroupBy) Float64s

func (cgb *CommentGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) Float64sX

func (cgb *CommentGroupBy) Float64sX(ctx context.Context) []float64

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

func (*CommentGroupBy) Int

func (cgb *CommentGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) IntX

func (cgb *CommentGroupBy) IntX(ctx context.Context) int

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

func (*CommentGroupBy) Ints

func (cgb *CommentGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) IntsX

func (cgb *CommentGroupBy) IntsX(ctx context.Context) []int

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

func (*CommentGroupBy) Scan

func (cgb *CommentGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*CommentGroupBy) ScanX

func (cgb *CommentGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*CommentGroupBy) String

func (cgb *CommentGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) StringX

func (cgb *CommentGroupBy) StringX(ctx context.Context) string

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

func (*CommentGroupBy) Strings

func (cgb *CommentGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*CommentGroupBy) StringsX

func (cgb *CommentGroupBy) StringsX(ctx context.Context) []string

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

type CommentMutation

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

CommentMutation represents an operation that mutates the Comment nodes in the graph.

func (*CommentMutation) AddChildIDs

func (m *CommentMutation) AddChildIDs(ids ...int)

AddChildIDs adds the "children" edge to the Comment entity by ids.

func (*CommentMutation) AddField

func (m *CommentMutation) 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 (*CommentMutation) AddVotes

func (m *CommentMutation) AddVotes(i int64)

AddVotes adds i to the "votes" field.

func (*CommentMutation) AddedEdges

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

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

func (*CommentMutation) AddedField

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

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

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

func (*CommentMutation) AddedIDs

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

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

func (*CommentMutation) AddedVotes

func (m *CommentMutation) AddedVotes() (r int64, exists bool)

AddedVotes returns the value that was added to the "votes" field in this mutation.

func (*CommentMutation) ChildrenCleared

func (m *CommentMutation) ChildrenCleared() bool

ChildrenCleared reports if the "children" edge to the Comment entity was cleared.

func (*CommentMutation) ChildrenIDs

func (m *CommentMutation) ChildrenIDs() (ids []int)

ChildrenIDs returns the "children" edge IDs in the mutation.

func (*CommentMutation) ClearChildren

func (m *CommentMutation) ClearChildren()

ClearChildren clears the "children" edge to the Comment entity.

func (*CommentMutation) ClearDeletedAt

func (m *CommentMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*CommentMutation) ClearEdge

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

func (m *CommentMutation) 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 (*CommentMutation) ClearParent

func (m *CommentMutation) ClearParent()

ClearParent clears the "parent" edge to the Comment entity.

func (*CommentMutation) ClearParentID

func (m *CommentMutation) ClearParentID()

ClearParentID clears the value of the "parent_id" field.

func (*CommentMutation) ClearPost

func (m *CommentMutation) ClearPost()

ClearPost clears the "post" edge to the Post entity.

func (*CommentMutation) ClearPostID

func (m *CommentMutation) ClearPostID()

ClearPostID clears the value of the "post_id" field.

func (*CommentMutation) ClearUser

func (m *CommentMutation) ClearUser()

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

func (*CommentMutation) ClearUserID

func (m *CommentMutation) ClearUserID()

ClearUserID clears the value of the "user_id" field.

func (*CommentMutation) ClearedEdges

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

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

func (*CommentMutation) ClearedFields

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

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

func (CommentMutation) Client

func (m CommentMutation) 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 (*CommentMutation) Content

func (m *CommentMutation) Content() (r string, exists bool)

Content returns the value of the "content" field in the mutation.

func (*CommentMutation) ContentHTML

func (m *CommentMutation) ContentHTML() (r string, exists bool)

ContentHTML returns the value of the "content_html" field in the mutation.

func (*CommentMutation) CreatedAt

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

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

func (*CommentMutation) DeletedAt

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

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

func (*CommentMutation) DeletedAtCleared

func (m *CommentMutation) DeletedAtCleared() bool

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

func (*CommentMutation) EdgeCleared

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

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

func (*CommentMutation) Field

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

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

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

func (*CommentMutation) Fields

func (m *CommentMutation) 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 (*CommentMutation) Filter

func (m *CommentMutation) Filter() *CommentFilter

Filter returns an entql.Where implementation to apply filters on the CommentMutation builder.

func (*CommentMutation) ID

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

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

func (*CommentMutation) IDs

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

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

func (*CommentMutation) OldContent

func (m *CommentMutation) OldContent(ctx context.Context) (v string, err error)

OldContent returns the old "content" field's value of the Comment entity. If the Comment 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 (*CommentMutation) OldContentHTML

func (m *CommentMutation) OldContentHTML(ctx context.Context) (v string, err error)

OldContentHTML returns the old "content_html" field's value of the Comment entity. If the Comment 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 (*CommentMutation) OldCreatedAt

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

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

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

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

func (m *CommentMutation) 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 (*CommentMutation) OldParentID

func (m *CommentMutation) OldParentID(ctx context.Context) (v int, err error)

OldParentID returns the old "parent_id" field's value of the Comment entity. If the Comment 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 (*CommentMutation) OldPostID

func (m *CommentMutation) OldPostID(ctx context.Context) (v int, err error)

OldPostID returns the old "post_id" field's value of the Comment entity. If the Comment 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 (*CommentMutation) OldUpdatedAt

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

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

func (m *CommentMutation) OldUserID(ctx context.Context) (v int, err error)

OldUserID returns the old "user_id" field's value of the Comment entity. If the Comment 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 (*CommentMutation) OldVotes

func (m *CommentMutation) OldVotes(ctx context.Context) (v int64, err error)

OldVotes returns the old "votes" field's value of the Comment entity. If the Comment 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 (*CommentMutation) Op

func (m *CommentMutation) Op() Op

Op returns the operation name.

func (*CommentMutation) ParentCleared

func (m *CommentMutation) ParentCleared() bool

ParentCleared reports if the "parent" edge to the Comment entity was cleared.

func (*CommentMutation) ParentID

func (m *CommentMutation) ParentID() (r int, exists bool)

ParentID returns the value of the "parent_id" field in the mutation.

func (*CommentMutation) ParentIDCleared

func (m *CommentMutation) ParentIDCleared() bool

ParentIDCleared returns if the "parent_id" field was cleared in this mutation.

func (*CommentMutation) ParentIDs

func (m *CommentMutation) ParentIDs() (ids []int)

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

func (*CommentMutation) PostCleared

func (m *CommentMutation) PostCleared() bool

PostCleared reports if the "post" edge to the Post entity was cleared.

func (*CommentMutation) PostID

func (m *CommentMutation) PostID() (r int, exists bool)

PostID returns the value of the "post_id" field in the mutation.

func (*CommentMutation) PostIDCleared

func (m *CommentMutation) PostIDCleared() bool

PostIDCleared returns if the "post_id" field was cleared in this mutation.

func (*CommentMutation) PostIDs

func (m *CommentMutation) PostIDs() (ids []int)

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 (*CommentMutation) RemoveChildIDs

func (m *CommentMutation) RemoveChildIDs(ids ...int)

RemoveChildIDs removes the "children" edge to the Comment entity by IDs.

func (*CommentMutation) RemovedChildrenIDs

func (m *CommentMutation) RemovedChildrenIDs() (ids []int)

RemovedChildren returns the removed IDs of the "children" edge to the Comment entity.

func (*CommentMutation) RemovedEdges

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

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

func (*CommentMutation) RemovedIDs

func (m *CommentMutation) 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 (*CommentMutation) ResetChildren

func (m *CommentMutation) ResetChildren()

ResetChildren resets all changes to the "children" edge.

func (*CommentMutation) ResetContent

func (m *CommentMutation) ResetContent()

ResetContent resets all changes to the "content" field.

func (*CommentMutation) ResetContentHTML

func (m *CommentMutation) ResetContentHTML()

ResetContentHTML resets all changes to the "content_html" field.

func (*CommentMutation) ResetCreatedAt

func (m *CommentMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*CommentMutation) ResetDeletedAt

func (m *CommentMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*CommentMutation) ResetEdge

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

func (m *CommentMutation) 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 (*CommentMutation) ResetParent

func (m *CommentMutation) ResetParent()

ResetParent resets all changes to the "parent" edge.

func (*CommentMutation) ResetParentID

func (m *CommentMutation) ResetParentID()

ResetParentID resets all changes to the "parent_id" field.

func (*CommentMutation) ResetPost

func (m *CommentMutation) ResetPost()

ResetPost resets all changes to the "post" edge.

func (*CommentMutation) ResetPostID

func (m *CommentMutation) ResetPostID()

ResetPostID resets all changes to the "post_id" field.

func (*CommentMutation) ResetUpdatedAt

func (m *CommentMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*CommentMutation) ResetUser

func (m *CommentMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*CommentMutation) ResetUserID

func (m *CommentMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*CommentMutation) ResetVotes

func (m *CommentMutation) ResetVotes()

ResetVotes resets all changes to the "votes" field.

func (*CommentMutation) SetContent

func (m *CommentMutation) SetContent(s string)

SetContent sets the "content" field.

func (*CommentMutation) SetContentHTML

func (m *CommentMutation) SetContentHTML(s string)

SetContentHTML sets the "content_html" field.

func (*CommentMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CommentMutation) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*CommentMutation) SetField

func (m *CommentMutation) 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 (*CommentMutation) SetParentID

func (m *CommentMutation) SetParentID(i int)

SetParentID sets the "parent_id" field.

func (*CommentMutation) SetPostID

func (m *CommentMutation) SetPostID(i int)

SetPostID sets the "post_id" field.

func (*CommentMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*CommentMutation) SetUserID

func (m *CommentMutation) SetUserID(i int)

SetUserID sets the "user_id" field.

func (*CommentMutation) SetVotes

func (m *CommentMutation) SetVotes(i int64)

SetVotes sets the "votes" field.

func (CommentMutation) Tx

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

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

func (*CommentMutation) Type

func (m *CommentMutation) Type() string

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

func (*CommentMutation) UpdatedAt

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

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

func (*CommentMutation) UserCleared

func (m *CommentMutation) UserCleared() bool

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

func (*CommentMutation) UserID

func (m *CommentMutation) UserID() (r int, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*CommentMutation) UserIDCleared

func (m *CommentMutation) UserIDCleared() bool

UserIDCleared returns if the "user_id" field was cleared in this mutation.

func (*CommentMutation) UserIDs

func (m *CommentMutation) UserIDs() (ids []int)

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

func (*CommentMutation) Votes

func (m *CommentMutation) Votes() (r int64, exists bool)

Votes returns the value of the "votes" field in the mutation.

func (*CommentMutation) Where

func (m *CommentMutation) Where(ps ...predicate.Comment)

Where appends a list predicates to the CommentMutation builder.

type CommentQuery

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

CommentQuery is the builder for querying Comment entities.

func (*CommentQuery) All

func (cq *CommentQuery) All(ctx context.Context) ([]*Comment, error)

All executes the query and returns a list of Comments.

func (*CommentQuery) AllX

func (cq *CommentQuery) AllX(ctx context.Context) []*Comment

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

func (*CommentQuery) Clone

func (cq *CommentQuery) Clone() *CommentQuery

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

func (*CommentQuery) Count

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

Count returns the count of the given query.

func (*CommentQuery) CountX

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

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

func (*CommentQuery) Exist

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

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

func (*CommentQuery) ExistX

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

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

func (*CommentQuery) Filter

func (cq *CommentQuery) Filter() *CommentFilter

Filter returns a Filter implementation to apply filters on the CommentQuery builder.

func (*CommentQuery) First

func (cq *CommentQuery) First(ctx context.Context) (*Comment, error)

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

func (*CommentQuery) FirstID

func (cq *CommentQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*CommentQuery) FirstIDX

func (cq *CommentQuery) FirstIDX(ctx context.Context) int

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

func (*CommentQuery) FirstX

func (cq *CommentQuery) FirstX(ctx context.Context) *Comment

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

func (*CommentQuery) GroupBy

func (cq *CommentQuery) GroupBy(field string, fields ...string) *CommentGroupBy

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

client.Comment.Query().
	GroupBy(comment.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CommentQuery) IDs

func (cq *CommentQuery) IDs(ctx context.Context) ([]int, error)

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

func (*CommentQuery) IDsX

func (cq *CommentQuery) IDsX(ctx context.Context) []int

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

func (*CommentQuery) Limit

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

Limit adds a limit step to the query.

func (*CommentQuery) Offset

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

Offset adds an offset step to the query.

func (*CommentQuery) Only

func (cq *CommentQuery) Only(ctx context.Context) (*Comment, error)

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

func (*CommentQuery) OnlyID

func (cq *CommentQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*CommentQuery) OnlyIDX

func (cq *CommentQuery) OnlyIDX(ctx context.Context) int

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

func (*CommentQuery) OnlyX

func (cq *CommentQuery) OnlyX(ctx context.Context) *Comment

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

func (*CommentQuery) Order

func (cq *CommentQuery) Order(o ...OrderFunc) *CommentQuery

Order adds an order step to the query.

func (*CommentQuery) QueryChildren

func (cq *CommentQuery) QueryChildren() *CommentQuery

QueryChildren chains the current query on the "children" edge.

func (*CommentQuery) QueryParent

func (cq *CommentQuery) QueryParent() *CommentQuery

QueryParent chains the current query on the "parent" edge.

func (*CommentQuery) QueryPost

func (cq *CommentQuery) QueryPost() *PostQuery

QueryPost chains the current query on the "post" edge.

func (*CommentQuery) QueryUser

func (cq *CommentQuery) QueryUser() *UserQuery

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

func (*CommentQuery) Select

func (cq *CommentQuery) Select(fields ...string) *CommentSelect

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:"omitempty"`
}

client.Comment.Query().
	Select(comment.FieldCreatedAt).
	Scan(ctx, &v)

func (*CommentQuery) Unique

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

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

func (cq *CommentQuery) Where(ps ...predicate.Comment) *CommentQuery

Where adds a new predicate for the CommentQuery builder.

func (*CommentQuery) WithChildren

func (cq *CommentQuery) WithChildren(opts ...func(*CommentQuery)) *CommentQuery

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

func (*CommentQuery) WithParent

func (cq *CommentQuery) WithParent(opts ...func(*CommentQuery)) *CommentQuery

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

func (*CommentQuery) WithPost

func (cq *CommentQuery) WithPost(opts ...func(*PostQuery)) *CommentQuery

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.

func (*CommentQuery) WithUser

func (cq *CommentQuery) WithUser(opts ...func(*UserQuery)) *CommentQuery

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

type CommentSelect

type CommentSelect struct {
	*CommentQuery
	// contains filtered or unexported fields
}

CommentSelect is the builder for selecting fields of Comment entities.

func (*CommentSelect) Bool

func (cs *CommentSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*CommentSelect) BoolX

func (cs *CommentSelect) BoolX(ctx context.Context) bool

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

func (*CommentSelect) Bools

func (cs *CommentSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*CommentSelect) BoolsX

func (cs *CommentSelect) BoolsX(ctx context.Context) []bool

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

func (*CommentSelect) Float64

func (cs *CommentSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*CommentSelect) Float64X

func (cs *CommentSelect) Float64X(ctx context.Context) float64

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

func (*CommentSelect) Float64s

func (cs *CommentSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*CommentSelect) Float64sX

func (cs *CommentSelect) Float64sX(ctx context.Context) []float64

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

func (*CommentSelect) Int

func (cs *CommentSelect) Int(ctx context.Context) (_ int, err error)

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

func (*CommentSelect) IntX

func (cs *CommentSelect) IntX(ctx context.Context) int

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

func (*CommentSelect) Ints

func (cs *CommentSelect) Ints(ctx context.Context) ([]int, error)

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

func (*CommentSelect) IntsX

func (cs *CommentSelect) IntsX(ctx context.Context) []int

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

func (*CommentSelect) Scan

func (cs *CommentSelect) Scan(ctx context.Context, v interface{}) error

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

func (*CommentSelect) ScanX

func (cs *CommentSelect) ScanX(ctx context.Context, v interface{})

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

func (*CommentSelect) String

func (cs *CommentSelect) String(ctx context.Context) (_ string, err error)

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

func (*CommentSelect) StringX

func (cs *CommentSelect) StringX(ctx context.Context) string

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

func (*CommentSelect) Strings

func (cs *CommentSelect) Strings(ctx context.Context) ([]string, error)

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

func (*CommentSelect) StringsX

func (cs *CommentSelect) StringsX(ctx context.Context) []string

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

type CommentUpdate

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

CommentUpdate is the builder for updating Comment entities.

func (*CommentUpdate) AddChildIDs

func (cu *CommentUpdate) AddChildIDs(ids ...int) *CommentUpdate

AddChildIDs adds the "children" edge to the Comment entity by IDs.

func (*CommentUpdate) AddChildren

func (cu *CommentUpdate) AddChildren(c ...*Comment) *CommentUpdate

AddChildren adds the "children" edges to the Comment entity.

func (*CommentUpdate) AddVotes

func (cu *CommentUpdate) AddVotes(i int64) *CommentUpdate

AddVotes adds i to the "votes" field.

func (*CommentUpdate) ClearChildren

func (cu *CommentUpdate) ClearChildren() *CommentUpdate

ClearChildren clears all "children" edges to the Comment entity.

func (*CommentUpdate) ClearDeletedAt

func (cu *CommentUpdate) ClearDeletedAt() *CommentUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*CommentUpdate) ClearParent

func (cu *CommentUpdate) ClearParent() *CommentUpdate

ClearParent clears the "parent" edge to the Comment entity.

func (*CommentUpdate) ClearParentID

func (cu *CommentUpdate) ClearParentID() *CommentUpdate

ClearParentID clears the value of the "parent_id" field.

func (*CommentUpdate) ClearPost

func (cu *CommentUpdate) ClearPost() *CommentUpdate

ClearPost clears the "post" edge to the Post entity.

func (*CommentUpdate) ClearPostID

func (cu *CommentUpdate) ClearPostID() *CommentUpdate

ClearPostID clears the value of the "post_id" field.

func (*CommentUpdate) ClearUser

func (cu *CommentUpdate) ClearUser() *CommentUpdate

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

func (*CommentUpdate) ClearUserID

func (cu *CommentUpdate) ClearUserID() *CommentUpdate

ClearUserID clears the value of the "user_id" field.

func (*CommentUpdate) Exec

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

Exec executes the query.

func (*CommentUpdate) ExecX

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

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

func (*CommentUpdate) Mutation

func (cu *CommentUpdate) Mutation() *CommentMutation

Mutation returns the CommentMutation object of the builder.

func (*CommentUpdate) RemoveChildIDs

func (cu *CommentUpdate) RemoveChildIDs(ids ...int) *CommentUpdate

RemoveChildIDs removes the "children" edge to Comment entities by IDs.

func (*CommentUpdate) RemoveChildren

func (cu *CommentUpdate) RemoveChildren(c ...*Comment) *CommentUpdate

RemoveChildren removes "children" edges to Comment entities.

func (*CommentUpdate) Save

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

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

func (*CommentUpdate) SaveX

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

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

func (*CommentUpdate) SetContent

func (cu *CommentUpdate) SetContent(s string) *CommentUpdate

SetContent sets the "content" field.

func (*CommentUpdate) SetContentHTML

func (cu *CommentUpdate) SetContentHTML(s string) *CommentUpdate

SetContentHTML sets the "content_html" field.

func (*CommentUpdate) SetDeletedAt

func (cu *CommentUpdate) SetDeletedAt(t time.Time) *CommentUpdate

SetDeletedAt sets the "deleted_at" field.

func (*CommentUpdate) SetNillableDeletedAt

func (cu *CommentUpdate) SetNillableDeletedAt(t *time.Time) *CommentUpdate

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

func (*CommentUpdate) SetNillableParentID

func (cu *CommentUpdate) SetNillableParentID(i *int) *CommentUpdate

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*CommentUpdate) SetNillablePostID

func (cu *CommentUpdate) SetNillablePostID(i *int) *CommentUpdate

SetNillablePostID sets the "post_id" field if the given value is not nil.

func (*CommentUpdate) SetNillableUserID

func (cu *CommentUpdate) SetNillableUserID(i *int) *CommentUpdate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*CommentUpdate) SetNillableVotes

func (cu *CommentUpdate) SetNillableVotes(i *int64) *CommentUpdate

SetNillableVotes sets the "votes" field if the given value is not nil.

func (*CommentUpdate) SetParent

func (cu *CommentUpdate) SetParent(c *Comment) *CommentUpdate

SetParent sets the "parent" edge to the Comment entity.

func (*CommentUpdate) SetParentID

func (cu *CommentUpdate) SetParentID(i int) *CommentUpdate

SetParentID sets the "parent_id" field.

func (*CommentUpdate) SetPost

func (cu *CommentUpdate) SetPost(p *Post) *CommentUpdate

SetPost sets the "post" edge to the Post entity.

func (*CommentUpdate) SetPostID

func (cu *CommentUpdate) SetPostID(i int) *CommentUpdate

SetPostID sets the "post_id" field.

func (*CommentUpdate) SetUpdatedAt

func (cu *CommentUpdate) SetUpdatedAt(t time.Time) *CommentUpdate

SetUpdatedAt sets the "updated_at" field.

func (*CommentUpdate) SetUser

func (cu *CommentUpdate) SetUser(u *User) *CommentUpdate

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

func (*CommentUpdate) SetUserID

func (cu *CommentUpdate) SetUserID(i int) *CommentUpdate

SetUserID sets the "user_id" field.

func (*CommentUpdate) SetVotes

func (cu *CommentUpdate) SetVotes(i int64) *CommentUpdate

SetVotes sets the "votes" field.

func (*CommentUpdate) Where

func (cu *CommentUpdate) Where(ps ...predicate.Comment) *CommentUpdate

Where appends a list predicates to the CommentUpdate builder.

type CommentUpdateOne

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

CommentUpdateOne is the builder for updating a single Comment entity.

func (*CommentUpdateOne) AddChildIDs

func (cuo *CommentUpdateOne) AddChildIDs(ids ...int) *CommentUpdateOne

AddChildIDs adds the "children" edge to the Comment entity by IDs.

func (*CommentUpdateOne) AddChildren

func (cuo *CommentUpdateOne) AddChildren(c ...*Comment) *CommentUpdateOne

AddChildren adds the "children" edges to the Comment entity.

func (*CommentUpdateOne) AddVotes

func (cuo *CommentUpdateOne) AddVotes(i int64) *CommentUpdateOne

AddVotes adds i to the "votes" field.

func (*CommentUpdateOne) ClearChildren

func (cuo *CommentUpdateOne) ClearChildren() *CommentUpdateOne

ClearChildren clears all "children" edges to the Comment entity.

func (*CommentUpdateOne) ClearDeletedAt

func (cuo *CommentUpdateOne) ClearDeletedAt() *CommentUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*CommentUpdateOne) ClearParent

func (cuo *CommentUpdateOne) ClearParent() *CommentUpdateOne

ClearParent clears the "parent" edge to the Comment entity.

func (*CommentUpdateOne) ClearParentID

func (cuo *CommentUpdateOne) ClearParentID() *CommentUpdateOne

ClearParentID clears the value of the "parent_id" field.

func (*CommentUpdateOne) ClearPost

func (cuo *CommentUpdateOne) ClearPost() *CommentUpdateOne

ClearPost clears the "post" edge to the Post entity.

func (*CommentUpdateOne) ClearPostID

func (cuo *CommentUpdateOne) ClearPostID() *CommentUpdateOne

ClearPostID clears the value of the "post_id" field.

func (*CommentUpdateOne) ClearUser

func (cuo *CommentUpdateOne) ClearUser() *CommentUpdateOne

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

func (*CommentUpdateOne) ClearUserID

func (cuo *CommentUpdateOne) ClearUserID() *CommentUpdateOne

ClearUserID clears the value of the "user_id" field.

func (*CommentUpdateOne) Exec

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

Exec executes the query on the entity.

func (*CommentUpdateOne) ExecX

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

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

func (*CommentUpdateOne) Mutation

func (cuo *CommentUpdateOne) Mutation() *CommentMutation

Mutation returns the CommentMutation object of the builder.

func (*CommentUpdateOne) RemoveChildIDs

func (cuo *CommentUpdateOne) RemoveChildIDs(ids ...int) *CommentUpdateOne

RemoveChildIDs removes the "children" edge to Comment entities by IDs.

func (*CommentUpdateOne) RemoveChildren

func (cuo *CommentUpdateOne) RemoveChildren(c ...*Comment) *CommentUpdateOne

RemoveChildren removes "children" edges to Comment entities.

func (*CommentUpdateOne) Save

func (cuo *CommentUpdateOne) Save(ctx context.Context) (*Comment, error)

Save executes the query and returns the updated Comment entity.

func (*CommentUpdateOne) SaveX

func (cuo *CommentUpdateOne) SaveX(ctx context.Context) *Comment

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

func (*CommentUpdateOne) Select

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

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

func (*CommentUpdateOne) SetContent

func (cuo *CommentUpdateOne) SetContent(s string) *CommentUpdateOne

SetContent sets the "content" field.

func (*CommentUpdateOne) SetContentHTML

func (cuo *CommentUpdateOne) SetContentHTML(s string) *CommentUpdateOne

SetContentHTML sets the "content_html" field.

func (*CommentUpdateOne) SetDeletedAt

func (cuo *CommentUpdateOne) SetDeletedAt(t time.Time) *CommentUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*CommentUpdateOne) SetNillableDeletedAt

func (cuo *CommentUpdateOne) SetNillableDeletedAt(t *time.Time) *CommentUpdateOne

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

func (*CommentUpdateOne) SetNillableParentID

func (cuo *CommentUpdateOne) SetNillableParentID(i *int) *CommentUpdateOne

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*CommentUpdateOne) SetNillablePostID

func (cuo *CommentUpdateOne) SetNillablePostID(i *int) *CommentUpdateOne

SetNillablePostID sets the "post_id" field if the given value is not nil.

func (*CommentUpdateOne) SetNillableUserID

func (cuo *CommentUpdateOne) SetNillableUserID(i *int) *CommentUpdateOne

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*CommentUpdateOne) SetNillableVotes

func (cuo *CommentUpdateOne) SetNillableVotes(i *int64) *CommentUpdateOne

SetNillableVotes sets the "votes" field if the given value is not nil.

func (*CommentUpdateOne) SetParent

func (cuo *CommentUpdateOne) SetParent(c *Comment) *CommentUpdateOne

SetParent sets the "parent" edge to the Comment entity.

func (*CommentUpdateOne) SetParentID

func (cuo *CommentUpdateOne) SetParentID(i int) *CommentUpdateOne

SetParentID sets the "parent_id" field.

func (*CommentUpdateOne) SetPost

func (cuo *CommentUpdateOne) SetPost(p *Post) *CommentUpdateOne

SetPost sets the "post" edge to the Post entity.

func (*CommentUpdateOne) SetPostID

func (cuo *CommentUpdateOne) SetPostID(i int) *CommentUpdateOne

SetPostID sets the "post_id" field.

func (*CommentUpdateOne) SetUpdatedAt

func (cuo *CommentUpdateOne) SetUpdatedAt(t time.Time) *CommentUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*CommentUpdateOne) SetUser

func (cuo *CommentUpdateOne) SetUser(u *User) *CommentUpdateOne

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

func (*CommentUpdateOne) SetUserID

func (cuo *CommentUpdateOne) SetUserID(i int) *CommentUpdateOne

SetUserID sets the "user_id" field.

func (*CommentUpdateOne) SetVotes

func (cuo *CommentUpdateOne) SetVotes(i int64) *CommentUpdateOne

SetVotes sets the "votes" field.

type CommentUpsert

type CommentUpsert struct {
	*sql.UpdateSet
}

CommentUpsert is the "OnConflict" setter.

func (*CommentUpsert) AddVotes

func (u *CommentUpsert) AddVotes(v int64) *CommentUpsert

AddVotes adds v to the "votes" field.

func (*CommentUpsert) ClearDeletedAt

func (u *CommentUpsert) ClearDeletedAt() *CommentUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*CommentUpsert) ClearParentID

func (u *CommentUpsert) ClearParentID() *CommentUpsert

ClearParentID clears the value of the "parent_id" field.

func (*CommentUpsert) ClearPostID

func (u *CommentUpsert) ClearPostID() *CommentUpsert

ClearPostID clears the value of the "post_id" field.

func (*CommentUpsert) ClearUserID

func (u *CommentUpsert) ClearUserID() *CommentUpsert

ClearUserID clears the value of the "user_id" field.

func (*CommentUpsert) SetContent

func (u *CommentUpsert) SetContent(v string) *CommentUpsert

SetContent sets the "content" field.

func (*CommentUpsert) SetContentHTML

func (u *CommentUpsert) SetContentHTML(v string) *CommentUpsert

SetContentHTML sets the "content_html" field.

func (*CommentUpsert) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CommentUpsert) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*CommentUpsert) SetParentID

func (u *CommentUpsert) SetParentID(v int) *CommentUpsert

SetParentID sets the "parent_id" field.

func (*CommentUpsert) SetPostID

func (u *CommentUpsert) SetPostID(v int) *CommentUpsert

SetPostID sets the "post_id" field.

func (*CommentUpsert) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*CommentUpsert) SetUserID

func (u *CommentUpsert) SetUserID(v int) *CommentUpsert

SetUserID sets the "user_id" field.

func (*CommentUpsert) SetVotes

func (u *CommentUpsert) SetVotes(v int64) *CommentUpsert

SetVotes sets the "votes" field.

func (*CommentUpsert) UpdateContent

func (u *CommentUpsert) UpdateContent() *CommentUpsert

UpdateContent sets the "content" field to the value that was provided on create.

func (*CommentUpsert) UpdateContentHTML

func (u *CommentUpsert) UpdateContentHTML() *CommentUpsert

UpdateContentHTML sets the "content_html" field to the value that was provided on create.

func (*CommentUpsert) UpdateCreatedAt

func (u *CommentUpsert) UpdateCreatedAt() *CommentUpsert

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

func (*CommentUpsert) UpdateDeletedAt

func (u *CommentUpsert) UpdateDeletedAt() *CommentUpsert

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

func (*CommentUpsert) UpdateParentID

func (u *CommentUpsert) UpdateParentID() *CommentUpsert

UpdateParentID sets the "parent_id" field to the value that was provided on create.

func (*CommentUpsert) UpdatePostID

func (u *CommentUpsert) UpdatePostID() *CommentUpsert

UpdatePostID sets the "post_id" field to the value that was provided on create.

func (*CommentUpsert) UpdateUpdatedAt

func (u *CommentUpsert) UpdateUpdatedAt() *CommentUpsert

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

func (*CommentUpsert) UpdateUserID

func (u *CommentUpsert) UpdateUserID() *CommentUpsert

UpdateUserID sets the "user_id" field to the value that was provided on create.

func (*CommentUpsert) UpdateVotes

func (u *CommentUpsert) UpdateVotes() *CommentUpsert

UpdateVotes sets the "votes" field to the value that was provided on create.

type CommentUpsertBulk

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

CommentUpsertBulk is the builder for "upsert"-ing a bulk of Comment nodes.

func (*CommentUpsertBulk) AddVotes

func (u *CommentUpsertBulk) AddVotes(v int64) *CommentUpsertBulk

AddVotes adds v to the "votes" field.

func (*CommentUpsertBulk) ClearDeletedAt

func (u *CommentUpsertBulk) ClearDeletedAt() *CommentUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*CommentUpsertBulk) ClearParentID

func (u *CommentUpsertBulk) ClearParentID() *CommentUpsertBulk

ClearParentID clears the value of the "parent_id" field.

func (*CommentUpsertBulk) ClearPostID

func (u *CommentUpsertBulk) ClearPostID() *CommentUpsertBulk

ClearPostID clears the value of the "post_id" field.

func (*CommentUpsertBulk) ClearUserID

func (u *CommentUpsertBulk) ClearUserID() *CommentUpsertBulk

ClearUserID clears the value of the "user_id" field.

func (*CommentUpsertBulk) DoNothing

func (u *CommentUpsertBulk) DoNothing() *CommentUpsertBulk

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

func (*CommentUpsertBulk) Exec

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

Exec executes the query.

func (*CommentUpsertBulk) ExecX

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

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

func (*CommentUpsertBulk) Ignore

func (u *CommentUpsertBulk) Ignore() *CommentUpsertBulk

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

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

func (*CommentUpsertBulk) SetContent

func (u *CommentUpsertBulk) SetContent(v string) *CommentUpsertBulk

SetContent sets the "content" field.

func (*CommentUpsertBulk) SetContentHTML

func (u *CommentUpsertBulk) SetContentHTML(v string) *CommentUpsertBulk

SetContentHTML sets the "content_html" field.

func (*CommentUpsertBulk) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CommentUpsertBulk) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*CommentUpsertBulk) SetParentID

func (u *CommentUpsertBulk) SetParentID(v int) *CommentUpsertBulk

SetParentID sets the "parent_id" field.

func (*CommentUpsertBulk) SetPostID

func (u *CommentUpsertBulk) SetPostID(v int) *CommentUpsertBulk

SetPostID sets the "post_id" field.

func (*CommentUpsertBulk) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*CommentUpsertBulk) SetUserID

func (u *CommentUpsertBulk) SetUserID(v int) *CommentUpsertBulk

SetUserID sets the "user_id" field.

func (*CommentUpsertBulk) SetVotes

func (u *CommentUpsertBulk) SetVotes(v int64) *CommentUpsertBulk

SetVotes sets the "votes" field.

func (*CommentUpsertBulk) Update

func (u *CommentUpsertBulk) Update(set func(*CommentUpsert)) *CommentUpsertBulk

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

func (*CommentUpsertBulk) UpdateContent

func (u *CommentUpsertBulk) UpdateContent() *CommentUpsertBulk

UpdateContent sets the "content" field to the value that was provided on create.

func (*CommentUpsertBulk) UpdateContentHTML

func (u *CommentUpsertBulk) UpdateContentHTML() *CommentUpsertBulk

UpdateContentHTML sets the "content_html" field to the value that was provided on create.

func (*CommentUpsertBulk) UpdateCreatedAt

func (u *CommentUpsertBulk) UpdateCreatedAt() *CommentUpsertBulk

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

func (*CommentUpsertBulk) UpdateDeletedAt

func (u *CommentUpsertBulk) UpdateDeletedAt() *CommentUpsertBulk

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

func (*CommentUpsertBulk) UpdateNewValues

func (u *CommentUpsertBulk) UpdateNewValues() *CommentUpsertBulk

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

client.Comment.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*CommentUpsertBulk) UpdateParentID

func (u *CommentUpsertBulk) UpdateParentID() *CommentUpsertBulk

UpdateParentID sets the "parent_id" field to the value that was provided on create.

func (*CommentUpsertBulk) UpdatePostID

func (u *CommentUpsertBulk) UpdatePostID() *CommentUpsertBulk

UpdatePostID sets the "post_id" field to the value that was provided on create.

func (*CommentUpsertBulk) UpdateUpdatedAt

func (u *CommentUpsertBulk) UpdateUpdatedAt() *CommentUpsertBulk

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

func (*CommentUpsertBulk) UpdateUserID

func (u *CommentUpsertBulk) UpdateUserID() *CommentUpsertBulk

UpdateUserID sets the "user_id" field to the value that was provided on create.

func (*CommentUpsertBulk) UpdateVotes

func (u *CommentUpsertBulk) UpdateVotes() *CommentUpsertBulk

UpdateVotes sets the "votes" field to the value that was provided on create.

type CommentUpsertOne

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

CommentUpsertOne is the builder for "upsert"-ing

one Comment node.

func (*CommentUpsertOne) AddVotes

func (u *CommentUpsertOne) AddVotes(v int64) *CommentUpsertOne

AddVotes adds v to the "votes" field.

func (*CommentUpsertOne) ClearDeletedAt

func (u *CommentUpsertOne) ClearDeletedAt() *CommentUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*CommentUpsertOne) ClearParentID

func (u *CommentUpsertOne) ClearParentID() *CommentUpsertOne

ClearParentID clears the value of the "parent_id" field.

func (*CommentUpsertOne) ClearPostID

func (u *CommentUpsertOne) ClearPostID() *CommentUpsertOne

ClearPostID clears the value of the "post_id" field.

func (*CommentUpsertOne) ClearUserID

func (u *CommentUpsertOne) ClearUserID() *CommentUpsertOne

ClearUserID clears the value of the "user_id" field.

func (*CommentUpsertOne) DoNothing

func (u *CommentUpsertOne) DoNothing() *CommentUpsertOne

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

func (*CommentUpsertOne) Exec

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

Exec executes the query.

func (*CommentUpsertOne) ExecX

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

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

func (*CommentUpsertOne) ID

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

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

func (*CommentUpsertOne) IDX

func (u *CommentUpsertOne) IDX(ctx context.Context) int

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

func (*CommentUpsertOne) Ignore

func (u *CommentUpsertOne) Ignore() *CommentUpsertOne

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

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

func (*CommentUpsertOne) SetContent

func (u *CommentUpsertOne) SetContent(v string) *CommentUpsertOne

SetContent sets the "content" field.

func (*CommentUpsertOne) SetContentHTML

func (u *CommentUpsertOne) SetContentHTML(v string) *CommentUpsertOne

SetContentHTML sets the "content_html" field.

func (*CommentUpsertOne) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*CommentUpsertOne) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*CommentUpsertOne) SetParentID

func (u *CommentUpsertOne) SetParentID(v int) *CommentUpsertOne

SetParentID sets the "parent_id" field.

func (*CommentUpsertOne) SetPostID

func (u *CommentUpsertOne) SetPostID(v int) *CommentUpsertOne

SetPostID sets the "post_id" field.

func (*CommentUpsertOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*CommentUpsertOne) SetUserID

func (u *CommentUpsertOne) SetUserID(v int) *CommentUpsertOne

SetUserID sets the "user_id" field.

func (*CommentUpsertOne) SetVotes

func (u *CommentUpsertOne) SetVotes(v int64) *CommentUpsertOne

SetVotes sets the "votes" field.

func (*CommentUpsertOne) Update

func (u *CommentUpsertOne) Update(set func(*CommentUpsert)) *CommentUpsertOne

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

func (*CommentUpsertOne) UpdateContent

func (u *CommentUpsertOne) UpdateContent() *CommentUpsertOne

UpdateContent sets the "content" field to the value that was provided on create.

func (*CommentUpsertOne) UpdateContentHTML

func (u *CommentUpsertOne) UpdateContentHTML() *CommentUpsertOne

UpdateContentHTML sets the "content_html" field to the value that was provided on create.

func (*CommentUpsertOne) UpdateCreatedAt

func (u *CommentUpsertOne) UpdateCreatedAt() *CommentUpsertOne

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

func (*CommentUpsertOne) UpdateDeletedAt

func (u *CommentUpsertOne) UpdateDeletedAt() *CommentUpsertOne

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

func (*CommentUpsertOne) UpdateNewValues

func (u *CommentUpsertOne) UpdateNewValues() *CommentUpsertOne

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

client.Comment.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*CommentUpsertOne) UpdateParentID

func (u *CommentUpsertOne) UpdateParentID() *CommentUpsertOne

UpdateParentID sets the "parent_id" field to the value that was provided on create.

func (*CommentUpsertOne) UpdatePostID

func (u *CommentUpsertOne) UpdatePostID() *CommentUpsertOne

UpdatePostID sets the "post_id" field to the value that was provided on create.

func (*CommentUpsertOne) UpdateUpdatedAt

func (u *CommentUpsertOne) UpdateUpdatedAt() *CommentUpsertOne

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

func (*CommentUpsertOne) UpdateUserID

func (u *CommentUpsertOne) UpdateUserID() *CommentUpsertOne

UpdateUserID sets the "user_id" field to the value that was provided on create.

func (*CommentUpsertOne) UpdateVotes

func (u *CommentUpsertOne) UpdateVotes() *CommentUpsertOne

UpdateVotes sets the "votes" field to the value that was provided on create.

type Comments

type Comments []*Comment

Comments is a parsable slice of Comment.

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 File

type File struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt time.Time `json:"omitempty"`
	// Disk holds the value of the "disk" field.
	Disk string `json:"disk,omitempty"`
	// Path holds the value of the "path" field.
	Path string `json:"path,omitempty"`
	// Type holds the value of the "type" field.
	Type string `json:"type,omitempty"`
	// Size holds the value of the "size" field.
	Size int `json:"size,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID int `json:"user_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the FileQuery when eager-loading is set.
	Edges FileEdges `json:"edges"`
	// contains filtered or unexported fields
}

File is the model entity for the File schema.

func (*File) QueryPages

func (f *File) QueryPages() *PageQuery

QueryPages queries the "pages" edge of the File entity.

func (*File) QueryPosts

func (f *File) QueryPosts() *PostQuery

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

func (*File) QueryUser

func (f *File) QueryUser() *UserQuery

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

func (*File) QueryUserAvatars

func (f *File) QueryUserAvatars() *UserQuery

QueryUserAvatars queries the "user_avatars" edge of the File entity.

func (*File) String

func (f *File) String() string

String implements the fmt.Stringer.

func (*File) Unwrap

func (f *File) Unwrap() *File

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

func (f *File) Update() *FileUpdateOne

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

type FileClient

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

FileClient is a client for the File schema.

func NewFileClient

func NewFileClient(c config) *FileClient

NewFileClient returns a client for the File from the given config.

func (*FileClient) Create

func (c *FileClient) Create() *FileCreate

Create returns a create builder for File.

func (*FileClient) CreateBulk

func (c *FileClient) CreateBulk(builders ...*FileCreate) *FileCreateBulk

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

func (*FileClient) Delete

func (c *FileClient) Delete() *FileDelete

Delete returns a delete builder for File.

func (*FileClient) DeleteOne

func (c *FileClient) DeleteOne(f *File) *FileDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*FileClient) DeleteOneID

func (c *FileClient) DeleteOneID(id int) *FileDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*FileClient) Get

func (c *FileClient) Get(ctx context.Context, id int) (*File, error)

Get returns a File entity by its id.

func (*FileClient) GetX

func (c *FileClient) GetX(ctx context.Context, id int) *File

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

func (*FileClient) Hooks

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

Hooks returns the client hooks.

func (*FileClient) Query

func (c *FileClient) Query() *FileQuery

Query returns a query builder for File.

func (*FileClient) QueryPages

func (c *FileClient) QueryPages(f *File) *PageQuery

QueryPages queries the pages edge of a File.

func (*FileClient) QueryPosts

func (c *FileClient) QueryPosts(f *File) *PostQuery

QueryPosts queries the posts edge of a File.

func (*FileClient) QueryUser

func (c *FileClient) QueryUser(f *File) *UserQuery

QueryUser queries the user edge of a File.

func (*FileClient) QueryUserAvatars

func (c *FileClient) QueryUserAvatars(f *File) *UserQuery

QueryUserAvatars queries the user_avatars edge of a File.

func (*FileClient) Update

func (c *FileClient) Update() *FileUpdate

Update returns an update builder for File.

func (*FileClient) UpdateOne

func (c *FileClient) UpdateOne(f *File) *FileUpdateOne

UpdateOne returns an update builder for the given entity.

func (*FileClient) UpdateOneID

func (c *FileClient) UpdateOneID(id int) *FileUpdateOne

UpdateOneID returns an update builder for the given id.

func (*FileClient) Use

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

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

type FileCreate

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

FileCreate is the builder for creating a File entity.

func (*FileCreate) AddPageIDs

func (fc *FileCreate) AddPageIDs(ids ...int) *FileCreate

AddPageIDs adds the "pages" edge to the Page entity by IDs.

func (*FileCreate) AddPages

func (fc *FileCreate) AddPages(p ...*Page) *FileCreate

AddPages adds the "pages" edges to the Page entity.

func (*FileCreate) AddPostIDs

func (fc *FileCreate) AddPostIDs(ids ...int) *FileCreate

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

func (*FileCreate) AddPosts

func (fc *FileCreate) AddPosts(p ...*Post) *FileCreate

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

func (*FileCreate) AddUserAvatarIDs

func (fc *FileCreate) AddUserAvatarIDs(ids ...int) *FileCreate

AddUserAvatarIDs adds the "user_avatars" edge to the User entity by IDs.

func (*FileCreate) AddUserAvatars

func (fc *FileCreate) AddUserAvatars(u ...*User) *FileCreate

AddUserAvatars adds the "user_avatars" edges to the User entity.

func (*FileCreate) Exec

func (fc *FileCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*FileCreate) ExecX

func (fc *FileCreate) ExecX(ctx context.Context)

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

func (*FileCreate) Mutation

func (fc *FileCreate) Mutation() *FileMutation

Mutation returns the FileMutation object of the builder.

func (*FileCreate) OnConflict

func (fc *FileCreate) OnConflict(opts ...sql.ConflictOption) *FileUpsertOne

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

client.File.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.FileUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*FileCreate) OnConflictColumns

func (fc *FileCreate) OnConflictColumns(columns ...string) *FileUpsertOne

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

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

func (*FileCreate) Save

func (fc *FileCreate) Save(ctx context.Context) (*File, error)

Save creates the File in the database.

func (*FileCreate) SaveX

func (fc *FileCreate) SaveX(ctx context.Context) *File

SaveX calls Save and panics if Save returns an error.

func (*FileCreate) SetCreatedAt

func (fc *FileCreate) SetCreatedAt(t time.Time) *FileCreate

SetCreatedAt sets the "created_at" field.

func (*FileCreate) SetDeletedAt

func (fc *FileCreate) SetDeletedAt(t time.Time) *FileCreate

SetDeletedAt sets the "deleted_at" field.

func (*FileCreate) SetDisk

func (fc *FileCreate) SetDisk(s string) *FileCreate

SetDisk sets the "disk" field.

func (*FileCreate) SetNillableCreatedAt

func (fc *FileCreate) SetNillableCreatedAt(t *time.Time) *FileCreate

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

func (*FileCreate) SetNillableDeletedAt

func (fc *FileCreate) SetNillableDeletedAt(t *time.Time) *FileCreate

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

func (*FileCreate) SetNillableUpdatedAt

func (fc *FileCreate) SetNillableUpdatedAt(t *time.Time) *FileCreate

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

func (*FileCreate) SetNillableUserID

func (fc *FileCreate) SetNillableUserID(i *int) *FileCreate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*FileCreate) SetPath

func (fc *FileCreate) SetPath(s string) *FileCreate

SetPath sets the "path" field.

func (*FileCreate) SetSize

func (fc *FileCreate) SetSize(i int) *FileCreate

SetSize sets the "size" field.

func (*FileCreate) SetType

func (fc *FileCreate) SetType(s string) *FileCreate

SetType sets the "type" field.

func (*FileCreate) SetUpdatedAt

func (fc *FileCreate) SetUpdatedAt(t time.Time) *FileCreate

SetUpdatedAt sets the "updated_at" field.

func (*FileCreate) SetUser

func (fc *FileCreate) SetUser(u *User) *FileCreate

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

func (*FileCreate) SetUserID

func (fc *FileCreate) SetUserID(i int) *FileCreate

SetUserID sets the "user_id" field.

type FileCreateBulk

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

FileCreateBulk is the builder for creating many File entities in bulk.

func (*FileCreateBulk) Exec

func (fcb *FileCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*FileCreateBulk) ExecX

func (fcb *FileCreateBulk) ExecX(ctx context.Context)

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

func (*FileCreateBulk) OnConflict

func (fcb *FileCreateBulk) OnConflict(opts ...sql.ConflictOption) *FileUpsertBulk

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

client.File.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.FileUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*FileCreateBulk) OnConflictColumns

func (fcb *FileCreateBulk) OnConflictColumns(columns ...string) *FileUpsertBulk

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

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

func (*FileCreateBulk) Save

func (fcb *FileCreateBulk) Save(ctx context.Context) ([]*File, error)

Save creates the File entities in the database.

func (*FileCreateBulk) SaveX

func (fcb *FileCreateBulk) SaveX(ctx context.Context) []*File

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

type FileDelete

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

FileDelete is the builder for deleting a File entity.

func (*FileDelete) Exec

func (fd *FileDelete) Exec(ctx context.Context) (int, error)

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

func (*FileDelete) ExecX

func (fd *FileDelete) ExecX(ctx context.Context) int

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

func (*FileDelete) Where

func (fd *FileDelete) Where(ps ...predicate.File) *FileDelete

Where appends a list predicates to the FileDelete builder.

type FileDeleteOne

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

FileDeleteOne is the builder for deleting a single File entity.

func (*FileDeleteOne) Exec

func (fdo *FileDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*FileDeleteOne) ExecX

func (fdo *FileDeleteOne) ExecX(ctx context.Context)

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

type FileEdges

type FileEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Posts holds the value of the posts edge.
	Posts []*Post `json:"posts,omitempty"`
	// Pages holds the value of the pages edge.
	Pages []*Page `json:"pages,omitempty"`
	// UserAvatars holds the value of the user_avatars edge.
	UserAvatars []*User `json:"user_avatars,omitempty"`
	// contains filtered or unexported fields
}

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

func (FileEdges) PagesOrErr

func (e FileEdges) PagesOrErr() ([]*Page, error)

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

func (FileEdges) PostsOrErr

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

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

func (FileEdges) UserAvatarsOrErr

func (e FileEdges) UserAvatarsOrErr() ([]*User, error)

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

func (FileEdges) UserOrErr

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

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

type FileFilter

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

FileFilter provides a generic filtering capability at runtime for FileQuery.

func (*FileFilter) Where

func (f *FileFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*FileFilter) WhereCreatedAt

func (f *FileFilter) WhereCreatedAt(p entql.TimeP)

WhereCreatedAt applies the entql time.Time predicate on the created_at field.

func (*FileFilter) WhereDeletedAt

func (f *FileFilter) WhereDeletedAt(p entql.TimeP)

WhereDeletedAt applies the entql time.Time predicate on the deleted_at field.

func (*FileFilter) WhereDisk

func (f *FileFilter) WhereDisk(p entql.StringP)

WhereDisk applies the entql string predicate on the disk field.

func (*FileFilter) WhereHasPages

func (f *FileFilter) WhereHasPages()

WhereHasPages applies a predicate to check if query has an edge pages.

func (*FileFilter) WhereHasPagesWith

func (f *FileFilter) WhereHasPagesWith(preds ...predicate.Page)

WhereHasPagesWith applies a predicate to check if query has an edge pages with a given conditions (other predicates).

func (*FileFilter) WhereHasPosts

func (f *FileFilter) WhereHasPosts()

WhereHasPosts applies a predicate to check if query has an edge posts.

func (*FileFilter) WhereHasPostsWith

func (f *FileFilter) WhereHasPostsWith(preds ...predicate.Post)

WhereHasPostsWith applies a predicate to check if query has an edge posts with a given conditions (other predicates).

func (*FileFilter) WhereHasUser

func (f *FileFilter) WhereHasUser()

WhereHasUser applies a predicate to check if query has an edge user.

func (*FileFilter) WhereHasUserAvatars

func (f *FileFilter) WhereHasUserAvatars()

WhereHasUserAvatars applies a predicate to check if query has an edge user_avatars.

func (*FileFilter) WhereHasUserAvatarsWith

func (f *FileFilter) WhereHasUserAvatarsWith(preds ...predicate.User)

WhereHasUserAvatarsWith applies a predicate to check if query has an edge user_avatars with a given conditions (other predicates).

func (*FileFilter) WhereHasUserWith

func (f *FileFilter) WhereHasUserWith(preds ...predicate.User)

WhereHasUserWith applies a predicate to check if query has an edge user with a given conditions (other predicates).

func (*FileFilter) WhereID

func (f *FileFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*FileFilter) WherePath

func (f *FileFilter) WherePath(p entql.StringP)

WherePath applies the entql string predicate on the path field.

func (*FileFilter) WhereSize

func (f *FileFilter) WhereSize(p entql.IntP)

WhereSize applies the entql int predicate on the size field.

func (*FileFilter) WhereType

func (f *FileFilter) WhereType(p entql.StringP)

WhereType applies the entql string predicate on the type field.

func (*FileFilter) WhereUpdatedAt

func (f *FileFilter) WhereUpdatedAt(p entql.TimeP)

WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.

func (*FileFilter) WhereUserID

func (f *FileFilter) WhereUserID(p entql.IntP)

WhereUserID applies the entql int predicate on the user_id field.

type FileGroupBy

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

FileGroupBy is the group-by builder for File entities.

func (*FileGroupBy) Aggregate

func (fgb *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy

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

func (*FileGroupBy) Bool

func (fgb *FileGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*FileGroupBy) BoolX

func (fgb *FileGroupBy) BoolX(ctx context.Context) bool

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

func (*FileGroupBy) Bools

func (fgb *FileGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*FileGroupBy) BoolsX

func (fgb *FileGroupBy) BoolsX(ctx context.Context) []bool

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

func (*FileGroupBy) Float64

func (fgb *FileGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*FileGroupBy) Float64X

func (fgb *FileGroupBy) Float64X(ctx context.Context) float64

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

func (*FileGroupBy) Float64s

func (fgb *FileGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*FileGroupBy) Float64sX

func (fgb *FileGroupBy) Float64sX(ctx context.Context) []float64

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

func (*FileGroupBy) Int

func (fgb *FileGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*FileGroupBy) IntX

func (fgb *FileGroupBy) IntX(ctx context.Context) int

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

func (*FileGroupBy) Ints

func (fgb *FileGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*FileGroupBy) IntsX

func (fgb *FileGroupBy) IntsX(ctx context.Context) []int

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

func (*FileGroupBy) Scan

func (fgb *FileGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*FileGroupBy) ScanX

func (fgb *FileGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*FileGroupBy) String

func (fgb *FileGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*FileGroupBy) StringX

func (fgb *FileGroupBy) StringX(ctx context.Context) string

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

func (*FileGroupBy) Strings

func (fgb *FileGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*FileGroupBy) StringsX

func (fgb *FileGroupBy) StringsX(ctx context.Context) []string

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

type FileMutation

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

FileMutation represents an operation that mutates the File nodes in the graph.

func (*FileMutation) AddField

func (m *FileMutation) 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 (*FileMutation) AddPageIDs

func (m *FileMutation) AddPageIDs(ids ...int)

AddPageIDs adds the "pages" edge to the Page entity by ids.

func (*FileMutation) AddPostIDs

func (m *FileMutation) AddPostIDs(ids ...int)

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

func (*FileMutation) AddSize

func (m *FileMutation) AddSize(i int)

AddSize adds i to the "size" field.

func (*FileMutation) AddUserAvatarIDs

func (m *FileMutation) AddUserAvatarIDs(ids ...int)

AddUserAvatarIDs adds the "user_avatars" edge to the User entity by ids.

func (*FileMutation) AddedEdges

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

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

func (*FileMutation) AddedField

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

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

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

func (*FileMutation) AddedIDs

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

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

func (*FileMutation) AddedSize

func (m *FileMutation) AddedSize() (r int, exists bool)

AddedSize returns the value that was added to the "size" field in this mutation.

func (*FileMutation) ClearDeletedAt

func (m *FileMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*FileMutation) ClearEdge

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

func (m *FileMutation) 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 (*FileMutation) ClearPages

func (m *FileMutation) ClearPages()

ClearPages clears the "pages" edge to the Page entity.

func (*FileMutation) ClearPosts

func (m *FileMutation) ClearPosts()

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

func (*FileMutation) ClearUser

func (m *FileMutation) ClearUser()

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

func (*FileMutation) ClearUserAvatars

func (m *FileMutation) ClearUserAvatars()

ClearUserAvatars clears the "user_avatars" edge to the User entity.

func (*FileMutation) ClearUserID

func (m *FileMutation) ClearUserID()

ClearUserID clears the value of the "user_id" field.

func (*FileMutation) ClearedEdges

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

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

func (*FileMutation) ClearedFields

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

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

func (FileMutation) Client

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

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

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

func (*FileMutation) DeletedAt

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

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

func (*FileMutation) DeletedAtCleared

func (m *FileMutation) DeletedAtCleared() bool

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

func (*FileMutation) Disk

func (m *FileMutation) Disk() (r string, exists bool)

Disk returns the value of the "disk" field in the mutation.

func (*FileMutation) EdgeCleared

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

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

func (*FileMutation) Field

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

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

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

func (*FileMutation) Fields

func (m *FileMutation) 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 (*FileMutation) Filter

func (m *FileMutation) Filter() *FileFilter

Filter returns an entql.Where implementation to apply filters on the FileMutation builder.

func (*FileMutation) GetType

func (m *FileMutation) GetType() (r string, exists bool)

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

func (*FileMutation) ID

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

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

func (*FileMutation) IDs

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

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

func (*FileMutation) OldCreatedAt

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

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

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

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

func (m *FileMutation) OldDisk(ctx context.Context) (v string, err error)

OldDisk returns the old "disk" field's value of the File entity. If the File 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 (*FileMutation) OldField

func (m *FileMutation) 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 (*FileMutation) OldPath

func (m *FileMutation) OldPath(ctx context.Context) (v string, err error)

OldPath returns the old "path" field's value of the File entity. If the File 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 (*FileMutation) OldSize

func (m *FileMutation) OldSize(ctx context.Context) (v int, err error)

OldSize returns the old "size" field's value of the File entity. If the File 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 (*FileMutation) OldType

func (m *FileMutation) OldType(ctx context.Context) (v string, err error)

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

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

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

func (m *FileMutation) OldUserID(ctx context.Context) (v int, err error)

OldUserID returns the old "user_id" field's value of the File entity. If the File 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 (*FileMutation) Op

func (m *FileMutation) Op() Op

Op returns the operation name.

func (*FileMutation) PagesCleared

func (m *FileMutation) PagesCleared() bool

PagesCleared reports if the "pages" edge to the Page entity was cleared.

func (*FileMutation) PagesIDs

func (m *FileMutation) PagesIDs() (ids []int)

PagesIDs returns the "pages" edge IDs in the mutation.

func (*FileMutation) Path

func (m *FileMutation) Path() (r string, exists bool)

Path returns the value of the "path" field in the mutation.

func (*FileMutation) PostsCleared

func (m *FileMutation) PostsCleared() bool

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

func (*FileMutation) PostsIDs

func (m *FileMutation) PostsIDs() (ids []int)

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

func (*FileMutation) RemovePageIDs

func (m *FileMutation) RemovePageIDs(ids ...int)

RemovePageIDs removes the "pages" edge to the Page entity by IDs.

func (*FileMutation) RemovePostIDs

func (m *FileMutation) RemovePostIDs(ids ...int)

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

func (*FileMutation) RemoveUserAvatarIDs

func (m *FileMutation) RemoveUserAvatarIDs(ids ...int)

RemoveUserAvatarIDs removes the "user_avatars" edge to the User entity by IDs.

func (*FileMutation) RemovedEdges

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

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

func (*FileMutation) RemovedIDs

func (m *FileMutation) 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 (*FileMutation) RemovedPagesIDs

func (m *FileMutation) RemovedPagesIDs() (ids []int)

RemovedPages returns the removed IDs of the "pages" edge to the Page entity.

func (*FileMutation) RemovedPostsIDs

func (m *FileMutation) RemovedPostsIDs() (ids []int)

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

func (*FileMutation) RemovedUserAvatarsIDs

func (m *FileMutation) RemovedUserAvatarsIDs() (ids []int)

RemovedUserAvatars returns the removed IDs of the "user_avatars" edge to the User entity.

func (*FileMutation) ResetCreatedAt

func (m *FileMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*FileMutation) ResetDeletedAt

func (m *FileMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*FileMutation) ResetDisk

func (m *FileMutation) ResetDisk()

ResetDisk resets all changes to the "disk" field.

func (*FileMutation) ResetEdge

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

func (m *FileMutation) 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 (*FileMutation) ResetPages

func (m *FileMutation) ResetPages()

ResetPages resets all changes to the "pages" edge.

func (*FileMutation) ResetPath

func (m *FileMutation) ResetPath()

ResetPath resets all changes to the "path" field.

func (*FileMutation) ResetPosts

func (m *FileMutation) ResetPosts()

ResetPosts resets all changes to the "posts" edge.

func (*FileMutation) ResetSize

func (m *FileMutation) ResetSize()

ResetSize resets all changes to the "size" field.

func (*FileMutation) ResetType

func (m *FileMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*FileMutation) ResetUpdatedAt

func (m *FileMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*FileMutation) ResetUser

func (m *FileMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*FileMutation) ResetUserAvatars

func (m *FileMutation) ResetUserAvatars()

ResetUserAvatars resets all changes to the "user_avatars" edge.

func (*FileMutation) ResetUserID

func (m *FileMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*FileMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*FileMutation) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*FileMutation) SetDisk

func (m *FileMutation) SetDisk(s string)

SetDisk sets the "disk" field.

func (*FileMutation) SetField

func (m *FileMutation) 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 (*FileMutation) SetPath

func (m *FileMutation) SetPath(s string)

SetPath sets the "path" field.

func (*FileMutation) SetSize

func (m *FileMutation) SetSize(i int)

SetSize sets the "size" field.

func (*FileMutation) SetType

func (m *FileMutation) SetType(s string)

SetType sets the "type" field.

func (*FileMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*FileMutation) SetUserID

func (m *FileMutation) SetUserID(i int)

SetUserID sets the "user_id" field.

func (*FileMutation) Size

func (m *FileMutation) Size() (r int, exists bool)

Size returns the value of the "size" field in the mutation.

func (FileMutation) Tx

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

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

func (*FileMutation) Type

func (m *FileMutation) Type() string

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

func (*FileMutation) UpdatedAt

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

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

func (*FileMutation) UserAvatarsCleared

func (m *FileMutation) UserAvatarsCleared() bool

UserAvatarsCleared reports if the "user_avatars" edge to the User entity was cleared.

func (*FileMutation) UserAvatarsIDs

func (m *FileMutation) UserAvatarsIDs() (ids []int)

UserAvatarsIDs returns the "user_avatars" edge IDs in the mutation.

func (*FileMutation) UserCleared

func (m *FileMutation) UserCleared() bool

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

func (*FileMutation) UserID

func (m *FileMutation) UserID() (r int, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*FileMutation) UserIDCleared

func (m *FileMutation) UserIDCleared() bool

UserIDCleared returns if the "user_id" field was cleared in this mutation.

func (*FileMutation) UserIDs

func (m *FileMutation) UserIDs() (ids []int)

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

func (*FileMutation) Where

func (m *FileMutation) Where(ps ...predicate.File)

Where appends a list predicates to the FileMutation builder.

type FileQuery

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

FileQuery is the builder for querying File entities.

func (*FileQuery) All

func (fq *FileQuery) All(ctx context.Context) ([]*File, error)

All executes the query and returns a list of Files.

func (*FileQuery) AllX

func (fq *FileQuery) AllX(ctx context.Context) []*File

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

func (*FileQuery) Clone

func (fq *FileQuery) Clone() *FileQuery

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

func (*FileQuery) Count

func (fq *FileQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*FileQuery) CountX

func (fq *FileQuery) CountX(ctx context.Context) int

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

func (*FileQuery) Exist

func (fq *FileQuery) Exist(ctx context.Context) (bool, error)

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

func (*FileQuery) ExistX

func (fq *FileQuery) ExistX(ctx context.Context) bool

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

func (*FileQuery) Filter

func (fq *FileQuery) Filter() *FileFilter

Filter returns a Filter implementation to apply filters on the FileQuery builder.

func (*FileQuery) First

func (fq *FileQuery) First(ctx context.Context) (*File, error)

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

func (*FileQuery) FirstID

func (fq *FileQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*FileQuery) FirstIDX

func (fq *FileQuery) FirstIDX(ctx context.Context) int

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

func (*FileQuery) FirstX

func (fq *FileQuery) FirstX(ctx context.Context) *File

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

func (*FileQuery) GroupBy

func (fq *FileQuery) GroupBy(field string, fields ...string) *FileGroupBy

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

client.File.Query().
	GroupBy(file.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*FileQuery) IDs

func (fq *FileQuery) IDs(ctx context.Context) ([]int, error)

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

func (*FileQuery) IDsX

func (fq *FileQuery) IDsX(ctx context.Context) []int

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

func (*FileQuery) Limit

func (fq *FileQuery) Limit(limit int) *FileQuery

Limit adds a limit step to the query.

func (*FileQuery) Offset

func (fq *FileQuery) Offset(offset int) *FileQuery

Offset adds an offset step to the query.

func (*FileQuery) Only

func (fq *FileQuery) Only(ctx context.Context) (*File, error)

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

func (*FileQuery) OnlyID

func (fq *FileQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*FileQuery) OnlyIDX

func (fq *FileQuery) OnlyIDX(ctx context.Context) int

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

func (*FileQuery) OnlyX

func (fq *FileQuery) OnlyX(ctx context.Context) *File

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

func (*FileQuery) Order

func (fq *FileQuery) Order(o ...OrderFunc) *FileQuery

Order adds an order step to the query.

func (*FileQuery) QueryPages

func (fq *FileQuery) QueryPages() *PageQuery

QueryPages chains the current query on the "pages" edge.

func (*FileQuery) QueryPosts

func (fq *FileQuery) QueryPosts() *PostQuery

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

func (*FileQuery) QueryUser

func (fq *FileQuery) QueryUser() *UserQuery

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

func (*FileQuery) QueryUserAvatars

func (fq *FileQuery) QueryUserAvatars() *UserQuery

QueryUserAvatars chains the current query on the "user_avatars" edge.

func (*FileQuery) Select

func (fq *FileQuery) Select(fields ...string) *FileSelect

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:"omitempty"`
}

client.File.Query().
	Select(file.FieldCreatedAt).
	Scan(ctx, &v)

func (*FileQuery) Unique

func (fq *FileQuery) Unique(unique bool) *FileQuery

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

func (fq *FileQuery) Where(ps ...predicate.File) *FileQuery

Where adds a new predicate for the FileQuery builder.

func (*FileQuery) WithPages

func (fq *FileQuery) WithPages(opts ...func(*PageQuery)) *FileQuery

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

func (*FileQuery) WithPosts

func (fq *FileQuery) WithPosts(opts ...func(*PostQuery)) *FileQuery

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 (*FileQuery) WithUser

func (fq *FileQuery) WithUser(opts ...func(*UserQuery)) *FileQuery

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

func (*FileQuery) WithUserAvatars

func (fq *FileQuery) WithUserAvatars(opts ...func(*UserQuery)) *FileQuery

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

type FileSelect

type FileSelect struct {
	*FileQuery
	// contains filtered or unexported fields
}

FileSelect is the builder for selecting fields of File entities.

func (*FileSelect) Bool

func (fs *FileSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*FileSelect) BoolX

func (fs *FileSelect) BoolX(ctx context.Context) bool

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

func (*FileSelect) Bools

func (fs *FileSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*FileSelect) BoolsX

func (fs *FileSelect) BoolsX(ctx context.Context) []bool

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

func (*FileSelect) Float64

func (fs *FileSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*FileSelect) Float64X

func (fs *FileSelect) Float64X(ctx context.Context) float64

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

func (*FileSelect) Float64s

func (fs *FileSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*FileSelect) Float64sX

func (fs *FileSelect) Float64sX(ctx context.Context) []float64

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

func (*FileSelect) Int

func (fs *FileSelect) Int(ctx context.Context) (_ int, err error)

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

func (*FileSelect) IntX

func (fs *FileSelect) IntX(ctx context.Context) int

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

func (*FileSelect) Ints

func (fs *FileSelect) Ints(ctx context.Context) ([]int, error)

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

func (*FileSelect) IntsX

func (fs *FileSelect) IntsX(ctx context.Context) []int

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

func (*FileSelect) Scan

func (fs *FileSelect) Scan(ctx context.Context, v interface{}) error

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

func (*FileSelect) ScanX

func (fs *FileSelect) ScanX(ctx context.Context, v interface{})

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

func (*FileSelect) String

func (fs *FileSelect) String(ctx context.Context) (_ string, err error)

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

func (*FileSelect) StringX

func (fs *FileSelect) StringX(ctx context.Context) string

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

func (*FileSelect) Strings

func (fs *FileSelect) Strings(ctx context.Context) ([]string, error)

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

func (*FileSelect) StringsX

func (fs *FileSelect) StringsX(ctx context.Context) []string

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

type FileUpdate

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

FileUpdate is the builder for updating File entities.

func (*FileUpdate) AddPageIDs

func (fu *FileUpdate) AddPageIDs(ids ...int) *FileUpdate

AddPageIDs adds the "pages" edge to the Page entity by IDs.

func (*FileUpdate) AddPages

func (fu *FileUpdate) AddPages(p ...*Page) *FileUpdate

AddPages adds the "pages" edges to the Page entity.

func (*FileUpdate) AddPostIDs

func (fu *FileUpdate) AddPostIDs(ids ...int) *FileUpdate

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

func (*FileUpdate) AddPosts

func (fu *FileUpdate) AddPosts(p ...*Post) *FileUpdate

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

func (*FileUpdate) AddSize

func (fu *FileUpdate) AddSize(i int) *FileUpdate

AddSize adds i to the "size" field.

func (*FileUpdate) AddUserAvatarIDs

func (fu *FileUpdate) AddUserAvatarIDs(ids ...int) *FileUpdate

AddUserAvatarIDs adds the "user_avatars" edge to the User entity by IDs.

func (*FileUpdate) AddUserAvatars

func (fu *FileUpdate) AddUserAvatars(u ...*User) *FileUpdate

AddUserAvatars adds the "user_avatars" edges to the User entity.

func (*FileUpdate) ClearDeletedAt

func (fu *FileUpdate) ClearDeletedAt() *FileUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*FileUpdate) ClearPages

func (fu *FileUpdate) ClearPages() *FileUpdate

ClearPages clears all "pages" edges to the Page entity.

func (*FileUpdate) ClearPosts

func (fu *FileUpdate) ClearPosts() *FileUpdate

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

func (*FileUpdate) ClearUser

func (fu *FileUpdate) ClearUser() *FileUpdate

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

func (*FileUpdate) ClearUserAvatars

func (fu *FileUpdate) ClearUserAvatars() *FileUpdate

ClearUserAvatars clears all "user_avatars" edges to the User entity.

func (*FileUpdate) ClearUserID

func (fu *FileUpdate) ClearUserID() *FileUpdate

ClearUserID clears the value of the "user_id" field.

func (*FileUpdate) Exec

func (fu *FileUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*FileUpdate) ExecX

func (fu *FileUpdate) ExecX(ctx context.Context)

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

func (*FileUpdate) Mutation

func (fu *FileUpdate) Mutation() *FileMutation

Mutation returns the FileMutation object of the builder.

func (*FileUpdate) RemovePageIDs

func (fu *FileUpdate) RemovePageIDs(ids ...int) *FileUpdate

RemovePageIDs removes the "pages" edge to Page entities by IDs.

func (*FileUpdate) RemovePages

func (fu *FileUpdate) RemovePages(p ...*Page) *FileUpdate

RemovePages removes "pages" edges to Page entities.

func (*FileUpdate) RemovePostIDs

func (fu *FileUpdate) RemovePostIDs(ids ...int) *FileUpdate

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

func (*FileUpdate) RemovePosts

func (fu *FileUpdate) RemovePosts(p ...*Post) *FileUpdate

RemovePosts removes "posts" edges to Post entities.

func (*FileUpdate) RemoveUserAvatarIDs

func (fu *FileUpdate) RemoveUserAvatarIDs(ids ...int) *FileUpdate

RemoveUserAvatarIDs removes the "user_avatars" edge to User entities by IDs.

func (*FileUpdate) RemoveUserAvatars

func (fu *FileUpdate) RemoveUserAvatars(u ...*User) *FileUpdate

RemoveUserAvatars removes "user_avatars" edges to User entities.

func (*FileUpdate) Save

func (fu *FileUpdate) Save(ctx context.Context) (int, error)

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

func (*FileUpdate) SaveX

func (fu *FileUpdate) SaveX(ctx context.Context) int

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

func (*FileUpdate) SetDeletedAt

func (fu *FileUpdate) SetDeletedAt(t time.Time) *FileUpdate

SetDeletedAt sets the "deleted_at" field.

func (*FileUpdate) SetDisk

func (fu *FileUpdate) SetDisk(s string) *FileUpdate

SetDisk sets the "disk" field.

func (*FileUpdate) SetNillableDeletedAt

func (fu *FileUpdate) SetNillableDeletedAt(t *time.Time) *FileUpdate

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

func (*FileUpdate) SetNillableUserID

func (fu *FileUpdate) SetNillableUserID(i *int) *FileUpdate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*FileUpdate) SetPath

func (fu *FileUpdate) SetPath(s string) *FileUpdate

SetPath sets the "path" field.

func (*FileUpdate) SetSize

func (fu *FileUpdate) SetSize(i int) *FileUpdate

SetSize sets the "size" field.

func (*FileUpdate) SetType

func (fu *FileUpdate) SetType(s string) *FileUpdate

SetType sets the "type" field.

func (*FileUpdate) SetUpdatedAt

func (fu *FileUpdate) SetUpdatedAt(t time.Time) *FileUpdate

SetUpdatedAt sets the "updated_at" field.

func (*FileUpdate) SetUser

func (fu *FileUpdate) SetUser(u *User) *FileUpdate

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

func (*FileUpdate) SetUserID

func (fu *FileUpdate) SetUserID(i int) *FileUpdate

SetUserID sets the "user_id" field.

func (*FileUpdate) Where

func (fu *FileUpdate) Where(ps ...predicate.File) *FileUpdate

Where appends a list predicates to the FileUpdate builder.

type FileUpdateOne

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

FileUpdateOne is the builder for updating a single File entity.

func (*FileUpdateOne) AddPageIDs

func (fuo *FileUpdateOne) AddPageIDs(ids ...int) *FileUpdateOne

AddPageIDs adds the "pages" edge to the Page entity by IDs.

func (*FileUpdateOne) AddPages

func (fuo *FileUpdateOne) AddPages(p ...*Page) *FileUpdateOne

AddPages adds the "pages" edges to the Page entity.

func (*FileUpdateOne) AddPostIDs

func (fuo *FileUpdateOne) AddPostIDs(ids ...int) *FileUpdateOne

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

func (*FileUpdateOne) AddPosts

func (fuo *FileUpdateOne) AddPosts(p ...*Post) *FileUpdateOne

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

func (*FileUpdateOne) AddSize

func (fuo *FileUpdateOne) AddSize(i int) *FileUpdateOne

AddSize adds i to the "size" field.

func (*FileUpdateOne) AddUserAvatarIDs

func (fuo *FileUpdateOne) AddUserAvatarIDs(ids ...int) *FileUpdateOne

AddUserAvatarIDs adds the "user_avatars" edge to the User entity by IDs.

func (*FileUpdateOne) AddUserAvatars

func (fuo *FileUpdateOne) AddUserAvatars(u ...*User) *FileUpdateOne

AddUserAvatars adds the "user_avatars" edges to the User entity.

func (*FileUpdateOne) ClearDeletedAt

func (fuo *FileUpdateOne) ClearDeletedAt() *FileUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*FileUpdateOne) ClearPages

func (fuo *FileUpdateOne) ClearPages() *FileUpdateOne

ClearPages clears all "pages" edges to the Page entity.

func (*FileUpdateOne) ClearPosts

func (fuo *FileUpdateOne) ClearPosts() *FileUpdateOne

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

func (*FileUpdateOne) ClearUser

func (fuo *FileUpdateOne) ClearUser() *FileUpdateOne

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

func (*FileUpdateOne) ClearUserAvatars

func (fuo *FileUpdateOne) ClearUserAvatars() *FileUpdateOne

ClearUserAvatars clears all "user_avatars" edges to the User entity.

func (*FileUpdateOne) ClearUserID

func (fuo *FileUpdateOne) ClearUserID() *FileUpdateOne

ClearUserID clears the value of the "user_id" field.

func (*FileUpdateOne) Exec

func (fuo *FileUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*FileUpdateOne) ExecX

func (fuo *FileUpdateOne) ExecX(ctx context.Context)

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

func (*FileUpdateOne) Mutation

func (fuo *FileUpdateOne) Mutation() *FileMutation

Mutation returns the FileMutation object of the builder.

func (*FileUpdateOne) RemovePageIDs

func (fuo *FileUpdateOne) RemovePageIDs(ids ...int) *FileUpdateOne

RemovePageIDs removes the "pages" edge to Page entities by IDs.

func (*FileUpdateOne) RemovePages

func (fuo *FileUpdateOne) RemovePages(p ...*Page) *FileUpdateOne

RemovePages removes "pages" edges to Page entities.

func (*FileUpdateOne) RemovePostIDs

func (fuo *FileUpdateOne) RemovePostIDs(ids ...int) *FileUpdateOne

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

func (*FileUpdateOne) RemovePosts

func (fuo *FileUpdateOne) RemovePosts(p ...*Post) *FileUpdateOne

RemovePosts removes "posts" edges to Post entities.

func (*FileUpdateOne) RemoveUserAvatarIDs

func (fuo *FileUpdateOne) RemoveUserAvatarIDs(ids ...int) *FileUpdateOne

RemoveUserAvatarIDs removes the "user_avatars" edge to User entities by IDs.

func (*FileUpdateOne) RemoveUserAvatars

func (fuo *FileUpdateOne) RemoveUserAvatars(u ...*User) *FileUpdateOne

RemoveUserAvatars removes "user_avatars" edges to User entities.

func (*FileUpdateOne) Save

func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error)

Save executes the query and returns the updated File entity.

func (*FileUpdateOne) SaveX

func (fuo *FileUpdateOne) SaveX(ctx context.Context) *File

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

func (*FileUpdateOne) Select

func (fuo *FileUpdateOne) Select(field string, fields ...string) *FileUpdateOne

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

func (*FileUpdateOne) SetDeletedAt

func (fuo *FileUpdateOne) SetDeletedAt(t time.Time) *FileUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*FileUpdateOne) SetDisk

func (fuo *FileUpdateOne) SetDisk(s string) *FileUpdateOne

SetDisk sets the "disk" field.

func (*FileUpdateOne) SetNillableDeletedAt

func (fuo *FileUpdateOne) SetNillableDeletedAt(t *time.Time) *FileUpdateOne

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

func (*FileUpdateOne) SetNillableUserID

func (fuo *FileUpdateOne) SetNillableUserID(i *int) *FileUpdateOne

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*FileUpdateOne) SetPath

func (fuo *FileUpdateOne) SetPath(s string) *FileUpdateOne

SetPath sets the "path" field.

func (*FileUpdateOne) SetSize

func (fuo *FileUpdateOne) SetSize(i int) *FileUpdateOne

SetSize sets the "size" field.

func (*FileUpdateOne) SetType

func (fuo *FileUpdateOne) SetType(s string) *FileUpdateOne

SetType sets the "type" field.

func (*FileUpdateOne) SetUpdatedAt

func (fuo *FileUpdateOne) SetUpdatedAt(t time.Time) *FileUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*FileUpdateOne) SetUser

func (fuo *FileUpdateOne) SetUser(u *User) *FileUpdateOne

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

func (*FileUpdateOne) SetUserID

func (fuo *FileUpdateOne) SetUserID(i int) *FileUpdateOne

SetUserID sets the "user_id" field.

type FileUpsert

type FileUpsert struct {
	*sql.UpdateSet
}

FileUpsert is the "OnConflict" setter.

func (*FileUpsert) AddSize

func (u *FileUpsert) AddSize(v int) *FileUpsert

AddSize adds v to the "size" field.

func (*FileUpsert) ClearDeletedAt

func (u *FileUpsert) ClearDeletedAt() *FileUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*FileUpsert) ClearUserID

func (u *FileUpsert) ClearUserID() *FileUpsert

ClearUserID clears the value of the "user_id" field.

func (*FileUpsert) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*FileUpsert) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*FileUpsert) SetDisk

func (u *FileUpsert) SetDisk(v string) *FileUpsert

SetDisk sets the "disk" field.

func (*FileUpsert) SetPath

func (u *FileUpsert) SetPath(v string) *FileUpsert

SetPath sets the "path" field.

func (*FileUpsert) SetSize

func (u *FileUpsert) SetSize(v int) *FileUpsert

SetSize sets the "size" field.

func (*FileUpsert) SetType

func (u *FileUpsert) SetType(v string) *FileUpsert

SetType sets the "type" field.

func (*FileUpsert) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*FileUpsert) SetUserID

func (u *FileUpsert) SetUserID(v int) *FileUpsert

SetUserID sets the "user_id" field.

func (*FileUpsert) UpdateCreatedAt

func (u *FileUpsert) UpdateCreatedAt() *FileUpsert

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

func (*FileUpsert) UpdateDeletedAt

func (u *FileUpsert) UpdateDeletedAt() *FileUpsert

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

func (*FileUpsert) UpdateDisk

func (u *FileUpsert) UpdateDisk() *FileUpsert

UpdateDisk sets the "disk" field to the value that was provided on create.

func (*FileUpsert) UpdatePath

func (u *FileUpsert) UpdatePath() *FileUpsert

UpdatePath sets the "path" field to the value that was provided on create.

func (*FileUpsert) UpdateSize

func (u *FileUpsert) UpdateSize() *FileUpsert

UpdateSize sets the "size" field to the value that was provided on create.

func (*FileUpsert) UpdateType

func (u *FileUpsert) UpdateType() *FileUpsert

UpdateType sets the "type" field to the value that was provided on create.

func (*FileUpsert) UpdateUpdatedAt

func (u *FileUpsert) UpdateUpdatedAt() *FileUpsert

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

func (*FileUpsert) UpdateUserID

func (u *FileUpsert) UpdateUserID() *FileUpsert

UpdateUserID sets the "user_id" field to the value that was provided on create.

type FileUpsertBulk

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

FileUpsertBulk is the builder for "upsert"-ing a bulk of File nodes.

func (*FileUpsertBulk) AddSize

func (u *FileUpsertBulk) AddSize(v int) *FileUpsertBulk

AddSize adds v to the "size" field.

func (*FileUpsertBulk) ClearDeletedAt

func (u *FileUpsertBulk) ClearDeletedAt() *FileUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*FileUpsertBulk) ClearUserID

func (u *FileUpsertBulk) ClearUserID() *FileUpsertBulk

ClearUserID clears the value of the "user_id" field.

func (*FileUpsertBulk) DoNothing

func (u *FileUpsertBulk) DoNothing() *FileUpsertBulk

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

func (*FileUpsertBulk) Exec

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

Exec executes the query.

func (*FileUpsertBulk) ExecX

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

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

func (*FileUpsertBulk) Ignore

func (u *FileUpsertBulk) Ignore() *FileUpsertBulk

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

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

func (*FileUpsertBulk) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*FileUpsertBulk) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*FileUpsertBulk) SetDisk

func (u *FileUpsertBulk) SetDisk(v string) *FileUpsertBulk

SetDisk sets the "disk" field.

func (*FileUpsertBulk) SetPath

func (u *FileUpsertBulk) SetPath(v string) *FileUpsertBulk

SetPath sets the "path" field.

func (*FileUpsertBulk) SetSize

func (u *FileUpsertBulk) SetSize(v int) *FileUpsertBulk

SetSize sets the "size" field.

func (*FileUpsertBulk) SetType

func (u *FileUpsertBulk) SetType(v string) *FileUpsertBulk

SetType sets the "type" field.

func (*FileUpsertBulk) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*FileUpsertBulk) SetUserID

func (u *FileUpsertBulk) SetUserID(v int) *FileUpsertBulk

SetUserID sets the "user_id" field.

func (*FileUpsertBulk) Update

func (u *FileUpsertBulk) Update(set func(*FileUpsert)) *FileUpsertBulk

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

func (*FileUpsertBulk) UpdateCreatedAt

func (u *FileUpsertBulk) UpdateCreatedAt() *FileUpsertBulk

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

func (*FileUpsertBulk) UpdateDeletedAt

func (u *FileUpsertBulk) UpdateDeletedAt() *FileUpsertBulk

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

func (*FileUpsertBulk) UpdateDisk

func (u *FileUpsertBulk) UpdateDisk() *FileUpsertBulk

UpdateDisk sets the "disk" field to the value that was provided on create.

func (*FileUpsertBulk) UpdateNewValues

func (u *FileUpsertBulk) UpdateNewValues() *FileUpsertBulk

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

client.File.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*FileUpsertBulk) UpdatePath

func (u *FileUpsertBulk) UpdatePath() *FileUpsertBulk

UpdatePath sets the "path" field to the value that was provided on create.

func (*FileUpsertBulk) UpdateSize

func (u *FileUpsertBulk) UpdateSize() *FileUpsertBulk

UpdateSize sets the "size" field to the value that was provided on create.

func (*FileUpsertBulk) UpdateType

func (u *FileUpsertBulk) UpdateType() *FileUpsertBulk

UpdateType sets the "type" field to the value that was provided on create.

func (*FileUpsertBulk) UpdateUpdatedAt

func (u *FileUpsertBulk) UpdateUpdatedAt() *FileUpsertBulk

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

func (*FileUpsertBulk) UpdateUserID

func (u *FileUpsertBulk) UpdateUserID() *FileUpsertBulk

UpdateUserID sets the "user_id" field to the value that was provided on create.

type FileUpsertOne

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

FileUpsertOne is the builder for "upsert"-ing

one File node.

func (*FileUpsertOne) AddSize

func (u *FileUpsertOne) AddSize(v int) *FileUpsertOne

AddSize adds v to the "size" field.

func (*FileUpsertOne) ClearDeletedAt

func (u *FileUpsertOne) ClearDeletedAt() *FileUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*FileUpsertOne) ClearUserID

func (u *FileUpsertOne) ClearUserID() *FileUpsertOne

ClearUserID clears the value of the "user_id" field.

func (*FileUpsertOne) DoNothing

func (u *FileUpsertOne) DoNothing() *FileUpsertOne

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

func (*FileUpsertOne) Exec

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

Exec executes the query.

func (*FileUpsertOne) ExecX

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

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

func (*FileUpsertOne) ID

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

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

func (*FileUpsertOne) IDX

func (u *FileUpsertOne) IDX(ctx context.Context) int

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

func (*FileUpsertOne) Ignore

func (u *FileUpsertOne) Ignore() *FileUpsertOne

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

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

func (*FileUpsertOne) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*FileUpsertOne) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*FileUpsertOne) SetDisk

func (u *FileUpsertOne) SetDisk(v string) *FileUpsertOne

SetDisk sets the "disk" field.

func (*FileUpsertOne) SetPath

func (u *FileUpsertOne) SetPath(v string) *FileUpsertOne

SetPath sets the "path" field.

func (*FileUpsertOne) SetSize

func (u *FileUpsertOne) SetSize(v int) *FileUpsertOne

SetSize sets the "size" field.

func (*FileUpsertOne) SetType

func (u *FileUpsertOne) SetType(v string) *FileUpsertOne

SetType sets the "type" field.

func (*FileUpsertOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*FileUpsertOne) SetUserID

func (u *FileUpsertOne) SetUserID(v int) *FileUpsertOne

SetUserID sets the "user_id" field.

func (*FileUpsertOne) Update

func (u *FileUpsertOne) Update(set func(*FileUpsert)) *FileUpsertOne

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

func (*FileUpsertOne) UpdateCreatedAt

func (u *FileUpsertOne) UpdateCreatedAt() *FileUpsertOne

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

func (*FileUpsertOne) UpdateDeletedAt

func (u *FileUpsertOne) UpdateDeletedAt() *FileUpsertOne

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

func (*FileUpsertOne) UpdateDisk

func (u *FileUpsertOne) UpdateDisk() *FileUpsertOne

UpdateDisk sets the "disk" field to the value that was provided on create.

func (*FileUpsertOne) UpdateNewValues

func (u *FileUpsertOne) UpdateNewValues() *FileUpsertOne

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

client.File.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*FileUpsertOne) UpdatePath

func (u *FileUpsertOne) UpdatePath() *FileUpsertOne

UpdatePath sets the "path" field to the value that was provided on create.

func (*FileUpsertOne) UpdateSize

func (u *FileUpsertOne) UpdateSize() *FileUpsertOne

UpdateSize sets the "size" field to the value that was provided on create.

func (*FileUpsertOne) UpdateType

func (u *FileUpsertOne) UpdateType() *FileUpsertOne

UpdateType sets the "type" field to the value that was provided on create.

func (*FileUpsertOne) UpdateUpdatedAt

func (u *FileUpsertOne) UpdateUpdatedAt() *FileUpsertOne

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

func (*FileUpsertOne) UpdateUserID

func (u *FileUpsertOne) UpdateUserID() *FileUpsertOne

UpdateUserID sets the "user_id" field to the value that was provided on create.

type Files

type Files []*File

Files is a parsable slice of File.

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 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 Page

type Page struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt time.Time `json:"omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Slug holds the value of the "slug" field.
	Slug string `json:"slug,omitempty"`
	// Content holds the value of the "content" field.
	Content string `json:"content,omitempty" validate:"required"`
	// ContentHTML holds the value of the "content_html" field.
	ContentHTML string `json:"content_html,omitempty"`
	// Draft holds the value of the "draft" field.
	Draft bool `json:"draft,omitempty"`
	// FeaturedImageID holds the value of the "featured_image_id" field.
	FeaturedImageID int `json:"featured_image_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PageQuery when eager-loading is set.
	Edges PageEdges `json:"edges"`
	// contains filtered or unexported fields
}

Page is the model entity for the Page schema.

func (*Page) QueryFeaturedImage

func (pa *Page) QueryFeaturedImage() *FileQuery

QueryFeaturedImage queries the "featured_image" edge of the Page entity.

func (*Page) String

func (pa *Page) String() string

String implements the fmt.Stringer.

func (*Page) Unwrap

func (pa *Page) Unwrap() *Page

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

func (pa *Page) Update() *PageUpdateOne

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

type PageClient

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

PageClient is a client for the Page schema.

func NewPageClient

func NewPageClient(c config) *PageClient

NewPageClient returns a client for the Page from the given config.

func (*PageClient) Create

func (c *PageClient) Create() *PageCreate

Create returns a create builder for Page.

func (*PageClient) CreateBulk

func (c *PageClient) CreateBulk(builders ...*PageCreate) *PageCreateBulk

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

func (*PageClient) Delete

func (c *PageClient) Delete() *PageDelete

Delete returns a delete builder for Page.

func (*PageClient) DeleteOne

func (c *PageClient) DeleteOne(pa *Page) *PageDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*PageClient) DeleteOneID

func (c *PageClient) DeleteOneID(id int) *PageDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*PageClient) Get

func (c *PageClient) Get(ctx context.Context, id int) (*Page, error)

Get returns a Page entity by its id.

func (*PageClient) GetX

func (c *PageClient) GetX(ctx context.Context, id int) *Page

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

func (*PageClient) Hooks

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

Hooks returns the client hooks.

func (*PageClient) Query

func (c *PageClient) Query() *PageQuery

Query returns a query builder for Page.

func (*PageClient) QueryFeaturedImage

func (c *PageClient) QueryFeaturedImage(pa *Page) *FileQuery

QueryFeaturedImage queries the featured_image edge of a Page.

func (*PageClient) Update

func (c *PageClient) Update() *PageUpdate

Update returns an update builder for Page.

func (*PageClient) UpdateOne

func (c *PageClient) UpdateOne(pa *Page) *PageUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PageClient) UpdateOneID

func (c *PageClient) UpdateOneID(id int) *PageUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PageClient) Use

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

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

type PageCreate

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

PageCreate is the builder for creating a Page entity.

func (*PageCreate) Exec

func (pc *PageCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PageCreate) ExecX

func (pc *PageCreate) ExecX(ctx context.Context)

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

func (*PageCreate) Mutation

func (pc *PageCreate) Mutation() *PageMutation

Mutation returns the PageMutation object of the builder.

func (*PageCreate) OnConflict

func (pc *PageCreate) OnConflict(opts ...sql.ConflictOption) *PageUpsertOne

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

client.Page.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.PageUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*PageCreate) OnConflictColumns

func (pc *PageCreate) OnConflictColumns(columns ...string) *PageUpsertOne

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

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

func (*PageCreate) Save

func (pc *PageCreate) Save(ctx context.Context) (*Page, error)

Save creates the Page in the database.

func (*PageCreate) SaveX

func (pc *PageCreate) SaveX(ctx context.Context) *Page

SaveX calls Save and panics if Save returns an error.

func (*PageCreate) SetContent

func (pc *PageCreate) SetContent(s string) *PageCreate

SetContent sets the "content" field.

func (*PageCreate) SetContentHTML

func (pc *PageCreate) SetContentHTML(s string) *PageCreate

SetContentHTML sets the "content_html" field.

func (*PageCreate) SetCreatedAt

func (pc *PageCreate) SetCreatedAt(t time.Time) *PageCreate

SetCreatedAt sets the "created_at" field.

func (*PageCreate) SetDeletedAt

func (pc *PageCreate) SetDeletedAt(t time.Time) *PageCreate

SetDeletedAt sets the "deleted_at" field.

func (*PageCreate) SetDraft

func (pc *PageCreate) SetDraft(b bool) *PageCreate

SetDraft sets the "draft" field.

func (*PageCreate) SetFeaturedImage

func (pc *PageCreate) SetFeaturedImage(f *File) *PageCreate

SetFeaturedImage sets the "featured_image" edge to the File entity.

func (*PageCreate) SetFeaturedImageID

func (pc *PageCreate) SetFeaturedImageID(i int) *PageCreate

SetFeaturedImageID sets the "featured_image_id" field.

func (*PageCreate) SetName

func (pc *PageCreate) SetName(s string) *PageCreate

SetName sets the "name" field.

func (*PageCreate) SetNillableCreatedAt

func (pc *PageCreate) SetNillableCreatedAt(t *time.Time) *PageCreate

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

func (*PageCreate) SetNillableDeletedAt

func (pc *PageCreate) SetNillableDeletedAt(t *time.Time) *PageCreate

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

func (*PageCreate) SetNillableDraft

func (pc *PageCreate) SetNillableDraft(b *bool) *PageCreate

SetNillableDraft sets the "draft" field if the given value is not nil.

func (*PageCreate) SetNillableFeaturedImageID

func (pc *PageCreate) SetNillableFeaturedImageID(i *int) *PageCreate

SetNillableFeaturedImageID sets the "featured_image_id" field if the given value is not nil.

func (*PageCreate) SetNillableUpdatedAt

func (pc *PageCreate) SetNillableUpdatedAt(t *time.Time) *PageCreate

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

func (*PageCreate) SetSlug

func (pc *PageCreate) SetSlug(s string) *PageCreate

SetSlug sets the "slug" field.

func (*PageCreate) SetUpdatedAt

func (pc *PageCreate) SetUpdatedAt(t time.Time) *PageCreate

SetUpdatedAt sets the "updated_at" field.

type PageCreateBulk

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

PageCreateBulk is the builder for creating many Page entities in bulk.

func (*PageCreateBulk) Exec

func (pcb *PageCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PageCreateBulk) ExecX

func (pcb *PageCreateBulk) ExecX(ctx context.Context)

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

func (*PageCreateBulk) OnConflict

func (pcb *PageCreateBulk) OnConflict(opts ...sql.ConflictOption) *PageUpsertBulk

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

client.Page.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.PageUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*PageCreateBulk) OnConflictColumns

func (pcb *PageCreateBulk) OnConflictColumns(columns ...string) *PageUpsertBulk

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

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

func (*PageCreateBulk) Save

func (pcb *PageCreateBulk) Save(ctx context.Context) ([]*Page, error)

Save creates the Page entities in the database.

func (*PageCreateBulk) SaveX

func (pcb *PageCreateBulk) SaveX(ctx context.Context) []*Page

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

type PageDelete

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

PageDelete is the builder for deleting a Page entity.

func (*PageDelete) Exec

func (pd *PageDelete) Exec(ctx context.Context) (int, error)

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

func (*PageDelete) ExecX

func (pd *PageDelete) ExecX(ctx context.Context) int

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

func (*PageDelete) Where

func (pd *PageDelete) Where(ps ...predicate.Page) *PageDelete

Where appends a list predicates to the PageDelete builder.

type PageDeleteOne

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

PageDeleteOne is the builder for deleting a single Page entity.

func (*PageDeleteOne) Exec

func (pdo *PageDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PageDeleteOne) ExecX

func (pdo *PageDeleteOne) ExecX(ctx context.Context)

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

type PageEdges

type PageEdges struct {
	// FeaturedImage holds the value of the featured_image edge.
	FeaturedImage *File `json:"featured_image,omitempty"`
	// contains filtered or unexported fields
}

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

func (PageEdges) FeaturedImageOrErr

func (e PageEdges) FeaturedImageOrErr() (*File, error)

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

type PageFilter

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

PageFilter provides a generic filtering capability at runtime for PageQuery.

func (*PageFilter) Where

func (f *PageFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*PageFilter) WhereContent

func (f *PageFilter) WhereContent(p entql.StringP)

WhereContent applies the entql string predicate on the content field.

func (*PageFilter) WhereContentHTML

func (f *PageFilter) WhereContentHTML(p entql.StringP)

WhereContentHTML applies the entql string predicate on the content_html field.

func (*PageFilter) WhereCreatedAt

func (f *PageFilter) WhereCreatedAt(p entql.TimeP)

WhereCreatedAt applies the entql time.Time predicate on the created_at field.

func (*PageFilter) WhereDeletedAt

func (f *PageFilter) WhereDeletedAt(p entql.TimeP)

WhereDeletedAt applies the entql time.Time predicate on the deleted_at field.

func (*PageFilter) WhereDraft

func (f *PageFilter) WhereDraft(p entql.BoolP)

WhereDraft applies the entql bool predicate on the draft field.

func (*PageFilter) WhereFeaturedImageID

func (f *PageFilter) WhereFeaturedImageID(p entql.IntP)

WhereFeaturedImageID applies the entql int predicate on the featured_image_id field.

func (*PageFilter) WhereHasFeaturedImage

func (f *PageFilter) WhereHasFeaturedImage()

WhereHasFeaturedImage applies a predicate to check if query has an edge featured_image.

func (*PageFilter) WhereHasFeaturedImageWith

func (f *PageFilter) WhereHasFeaturedImageWith(preds ...predicate.File)

WhereHasFeaturedImageWith applies a predicate to check if query has an edge featured_image with a given conditions (other predicates).

func (*PageFilter) WhereID

func (f *PageFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*PageFilter) WhereName

func (f *PageFilter) WhereName(p entql.StringP)

WhereName applies the entql string predicate on the name field.

func (*PageFilter) WhereSlug

func (f *PageFilter) WhereSlug(p entql.StringP)

WhereSlug applies the entql string predicate on the slug field.

func (*PageFilter) WhereUpdatedAt

func (f *PageFilter) WhereUpdatedAt(p entql.TimeP)

WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.

type PageGroupBy

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

PageGroupBy is the group-by builder for Page entities.

func (*PageGroupBy) Aggregate

func (pgb *PageGroupBy) Aggregate(fns ...AggregateFunc) *PageGroupBy

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

func (*PageGroupBy) Bool

func (pgb *PageGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PageGroupBy) BoolX

func (pgb *PageGroupBy) BoolX(ctx context.Context) bool

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

func (*PageGroupBy) Bools

func (pgb *PageGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*PageGroupBy) BoolsX

func (pgb *PageGroupBy) BoolsX(ctx context.Context) []bool

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

func (*PageGroupBy) Float64

func (pgb *PageGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PageGroupBy) Float64X

func (pgb *PageGroupBy) Float64X(ctx context.Context) float64

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

func (*PageGroupBy) Float64s

func (pgb *PageGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*PageGroupBy) Float64sX

func (pgb *PageGroupBy) Float64sX(ctx context.Context) []float64

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

func (*PageGroupBy) Int

func (pgb *PageGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PageGroupBy) IntX

func (pgb *PageGroupBy) IntX(ctx context.Context) int

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

func (*PageGroupBy) Ints

func (pgb *PageGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*PageGroupBy) IntsX

func (pgb *PageGroupBy) IntsX(ctx context.Context) []int

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

func (*PageGroupBy) Scan

func (pgb *PageGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*PageGroupBy) ScanX

func (pgb *PageGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*PageGroupBy) String

func (pgb *PageGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PageGroupBy) StringX

func (pgb *PageGroupBy) StringX(ctx context.Context) string

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

func (*PageGroupBy) Strings

func (pgb *PageGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*PageGroupBy) StringsX

func (pgb *PageGroupBy) StringsX(ctx context.Context) []string

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

type PageMutation

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

PageMutation represents an operation that mutates the Page nodes in the graph.

func (*PageMutation) AddField

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

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

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

func (*PageMutation) AddedField

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

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

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

func (*PageMutation) AddedIDs

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

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

func (*PageMutation) ClearDeletedAt

func (m *PageMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PageMutation) ClearDraft

func (m *PageMutation) ClearDraft()

ClearDraft clears the value of the "draft" field.

func (*PageMutation) ClearEdge

func (m *PageMutation) 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 (*PageMutation) ClearFeaturedImage

func (m *PageMutation) ClearFeaturedImage()

ClearFeaturedImage clears the "featured_image" edge to the File entity.

func (*PageMutation) ClearFeaturedImageID

func (m *PageMutation) ClearFeaturedImageID()

ClearFeaturedImageID clears the value of the "featured_image_id" field.

func (*PageMutation) ClearField

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

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

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

func (*PageMutation) ClearedFields

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

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

func (PageMutation) Client

func (m PageMutation) 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 (*PageMutation) Content

func (m *PageMutation) Content() (r string, exists bool)

Content returns the value of the "content" field in the mutation.

func (*PageMutation) ContentHTML

func (m *PageMutation) ContentHTML() (r string, exists bool)

ContentHTML returns the value of the "content_html" field in the mutation.

func (*PageMutation) CreatedAt

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

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

func (*PageMutation) DeletedAt

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

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

func (*PageMutation) DeletedAtCleared

func (m *PageMutation) DeletedAtCleared() bool

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

func (*PageMutation) Draft

func (m *PageMutation) Draft() (r bool, exists bool)

Draft returns the value of the "draft" field in the mutation.

func (*PageMutation) DraftCleared

func (m *PageMutation) DraftCleared() bool

DraftCleared returns if the "draft" field was cleared in this mutation.

func (*PageMutation) EdgeCleared

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

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

func (*PageMutation) FeaturedImageCleared

func (m *PageMutation) FeaturedImageCleared() bool

FeaturedImageCleared reports if the "featured_image" edge to the File entity was cleared.

func (*PageMutation) FeaturedImageID

func (m *PageMutation) FeaturedImageID() (r int, exists bool)

FeaturedImageID returns the value of the "featured_image_id" field in the mutation.

func (*PageMutation) FeaturedImageIDCleared

func (m *PageMutation) FeaturedImageIDCleared() bool

FeaturedImageIDCleared returns if the "featured_image_id" field was cleared in this mutation.

func (*PageMutation) FeaturedImageIDs

func (m *PageMutation) FeaturedImageIDs() (ids []int)

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

func (*PageMutation) Field

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

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

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

func (*PageMutation) Fields

func (m *PageMutation) 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 (*PageMutation) Filter

func (m *PageMutation) Filter() *PageFilter

Filter returns an entql.Where implementation to apply filters on the PageMutation builder.

func (*PageMutation) ID

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

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

func (*PageMutation) IDs

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

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

func (*PageMutation) Name

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

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

func (*PageMutation) OldContent

func (m *PageMutation) OldContent(ctx context.Context) (v string, err error)

OldContent returns the old "content" field's value of the Page entity. If the Page 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 (*PageMutation) OldContentHTML

func (m *PageMutation) OldContentHTML(ctx context.Context) (v string, err error)

OldContentHTML returns the old "content_html" field's value of the Page entity. If the Page 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 (*PageMutation) OldCreatedAt

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

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

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

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

func (m *PageMutation) OldDraft(ctx context.Context) (v bool, err error)

OldDraft returns the old "draft" field's value of the Page entity. If the Page 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 (*PageMutation) OldFeaturedImageID

func (m *PageMutation) OldFeaturedImageID(ctx context.Context) (v int, err error)

OldFeaturedImageID returns the old "featured_image_id" field's value of the Page entity. If the Page 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 (*PageMutation) OldField

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

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

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

func (m *PageMutation) OldSlug(ctx context.Context) (v string, err error)

OldSlug returns the old "slug" field's value of the Page entity. If the Page 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 (*PageMutation) OldUpdatedAt

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

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

func (m *PageMutation) Op() Op

Op returns the operation name.

func (*PageMutation) RemovedEdges

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

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

func (*PageMutation) RemovedIDs

func (m *PageMutation) 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 (*PageMutation) ResetContent

func (m *PageMutation) ResetContent()

ResetContent resets all changes to the "content" field.

func (*PageMutation) ResetContentHTML

func (m *PageMutation) ResetContentHTML()

ResetContentHTML resets all changes to the "content_html" field.

func (*PageMutation) ResetCreatedAt

func (m *PageMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*PageMutation) ResetDeletedAt

func (m *PageMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*PageMutation) ResetDraft

func (m *PageMutation) ResetDraft()

ResetDraft resets all changes to the "draft" field.

func (*PageMutation) ResetEdge

func (m *PageMutation) 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 (*PageMutation) ResetFeaturedImage

func (m *PageMutation) ResetFeaturedImage()

ResetFeaturedImage resets all changes to the "featured_image" edge.

func (*PageMutation) ResetFeaturedImageID

func (m *PageMutation) ResetFeaturedImageID()

ResetFeaturedImageID resets all changes to the "featured_image_id" field.

func (*PageMutation) ResetField

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

func (m *PageMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*PageMutation) ResetSlug

func (m *PageMutation) ResetSlug()

ResetSlug resets all changes to the "slug" field.

func (*PageMutation) ResetUpdatedAt

func (m *PageMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*PageMutation) SetContent

func (m *PageMutation) SetContent(s string)

SetContent sets the "content" field.

func (*PageMutation) SetContentHTML

func (m *PageMutation) SetContentHTML(s string)

SetContentHTML sets the "content_html" field.

func (*PageMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*PageMutation) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*PageMutation) SetDraft

func (m *PageMutation) SetDraft(b bool)

SetDraft sets the "draft" field.

func (*PageMutation) SetFeaturedImageID

func (m *PageMutation) SetFeaturedImageID(i int)

SetFeaturedImageID sets the "featured_image_id" field.

func (*PageMutation) SetField

func (m *PageMutation) 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 (*PageMutation) SetName

func (m *PageMutation) SetName(s string)

SetName sets the "name" field.

func (*PageMutation) SetSlug

func (m *PageMutation) SetSlug(s string)

SetSlug sets the "slug" field.

func (*PageMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*PageMutation) Slug

func (m *PageMutation) Slug() (r string, exists bool)

Slug returns the value of the "slug" field in the mutation.

func (PageMutation) Tx

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

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

func (*PageMutation) Type

func (m *PageMutation) Type() string

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

func (*PageMutation) UpdatedAt

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

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

func (*PageMutation) Where

func (m *PageMutation) Where(ps ...predicate.Page)

Where appends a list predicates to the PageMutation builder.

type PageQuery

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

PageQuery is the builder for querying Page entities.

func (*PageQuery) All

func (pq *PageQuery) All(ctx context.Context) ([]*Page, error)

All executes the query and returns a list of Pages.

func (*PageQuery) AllX

func (pq *PageQuery) AllX(ctx context.Context) []*Page

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

func (*PageQuery) Clone

func (pq *PageQuery) Clone() *PageQuery

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

func (*PageQuery) Count

func (pq *PageQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PageQuery) CountX

func (pq *PageQuery) CountX(ctx context.Context) int

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

func (*PageQuery) Exist

func (pq *PageQuery) Exist(ctx context.Context) (bool, error)

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

func (*PageQuery) ExistX

func (pq *PageQuery) ExistX(ctx context.Context) bool

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

func (*PageQuery) Filter

func (pq *PageQuery) Filter() *PageFilter

Filter returns a Filter implementation to apply filters on the PageQuery builder.

func (*PageQuery) First

func (pq *PageQuery) First(ctx context.Context) (*Page, error)

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

func (*PageQuery) FirstID

func (pq *PageQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*PageQuery) FirstIDX

func (pq *PageQuery) FirstIDX(ctx context.Context) int

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

func (*PageQuery) FirstX

func (pq *PageQuery) FirstX(ctx context.Context) *Page

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

func (*PageQuery) GroupBy

func (pq *PageQuery) GroupBy(field string, fields ...string) *PageGroupBy

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

client.Page.Query().
	GroupBy(page.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PageQuery) IDs

func (pq *PageQuery) IDs(ctx context.Context) ([]int, error)

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

func (*PageQuery) IDsX

func (pq *PageQuery) IDsX(ctx context.Context) []int

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

func (*PageQuery) Limit

func (pq *PageQuery) Limit(limit int) *PageQuery

Limit adds a limit step to the query.

func (*PageQuery) Offset

func (pq *PageQuery) Offset(offset int) *PageQuery

Offset adds an offset step to the query.

func (*PageQuery) Only

func (pq *PageQuery) Only(ctx context.Context) (*Page, error)

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

func (*PageQuery) OnlyID

func (pq *PageQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*PageQuery) OnlyIDX

func (pq *PageQuery) OnlyIDX(ctx context.Context) int

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

func (*PageQuery) OnlyX

func (pq *PageQuery) OnlyX(ctx context.Context) *Page

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

func (*PageQuery) Order

func (pq *PageQuery) Order(o ...OrderFunc) *PageQuery

Order adds an order step to the query.

func (*PageQuery) QueryFeaturedImage

func (pq *PageQuery) QueryFeaturedImage() *FileQuery

QueryFeaturedImage chains the current query on the "featured_image" edge.

func (*PageQuery) Select

func (pq *PageQuery) Select(fields ...string) *PageSelect

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:"omitempty"`
}

client.Page.Query().
	Select(page.FieldCreatedAt).
	Scan(ctx, &v)

func (*PageQuery) Unique

func (pq *PageQuery) Unique(unique bool) *PageQuery

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

func (pq *PageQuery) Where(ps ...predicate.Page) *PageQuery

Where adds a new predicate for the PageQuery builder.

func (*PageQuery) WithFeaturedImage

func (pq *PageQuery) WithFeaturedImage(opts ...func(*FileQuery)) *PageQuery

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

type PageSelect

type PageSelect struct {
	*PageQuery
	// contains filtered or unexported fields
}

PageSelect is the builder for selecting fields of Page entities.

func (*PageSelect) Bool

func (ps *PageSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*PageSelect) BoolX

func (ps *PageSelect) BoolX(ctx context.Context) bool

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

func (*PageSelect) Bools

func (ps *PageSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*PageSelect) BoolsX

func (ps *PageSelect) BoolsX(ctx context.Context) []bool

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

func (*PageSelect) Float64

func (ps *PageSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*PageSelect) Float64X

func (ps *PageSelect) Float64X(ctx context.Context) float64

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

func (*PageSelect) Float64s

func (ps *PageSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*PageSelect) Float64sX

func (ps *PageSelect) Float64sX(ctx context.Context) []float64

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

func (*PageSelect) Int

func (ps *PageSelect) Int(ctx context.Context) (_ int, err error)

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

func (*PageSelect) IntX

func (ps *PageSelect) IntX(ctx context.Context) int

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

func (*PageSelect) Ints

func (ps *PageSelect) Ints(ctx context.Context) ([]int, error)

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

func (*PageSelect) IntsX

func (ps *PageSelect) IntsX(ctx context.Context) []int

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

func (*PageSelect) Scan

func (ps *PageSelect) Scan(ctx context.Context, v interface{}) error

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

func (*PageSelect) ScanX

func (ps *PageSelect) ScanX(ctx context.Context, v interface{})

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

func (*PageSelect) String

func (ps *PageSelect) String(ctx context.Context) (_ string, err error)

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

func (*PageSelect) StringX

func (ps *PageSelect) StringX(ctx context.Context) string

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

func (*PageSelect) Strings

func (ps *PageSelect) Strings(ctx context.Context) ([]string, error)

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

func (*PageSelect) StringsX

func (ps *PageSelect) StringsX(ctx context.Context) []string

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

type PageUpdate

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

PageUpdate is the builder for updating Page entities.

func (*PageUpdate) ClearDeletedAt

func (pu *PageUpdate) ClearDeletedAt() *PageUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PageUpdate) ClearDraft

func (pu *PageUpdate) ClearDraft() *PageUpdate

ClearDraft clears the value of the "draft" field.

func (*PageUpdate) ClearFeaturedImage

func (pu *PageUpdate) ClearFeaturedImage() *PageUpdate

ClearFeaturedImage clears the "featured_image" edge to the File entity.

func (*PageUpdate) ClearFeaturedImageID

func (pu *PageUpdate) ClearFeaturedImageID() *PageUpdate

ClearFeaturedImageID clears the value of the "featured_image_id" field.

func (*PageUpdate) Exec

func (pu *PageUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PageUpdate) ExecX

func (pu *PageUpdate) ExecX(ctx context.Context)

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

func (*PageUpdate) Mutation

func (pu *PageUpdate) Mutation() *PageMutation

Mutation returns the PageMutation object of the builder.

func (*PageUpdate) Save

func (pu *PageUpdate) Save(ctx context.Context) (int, error)

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

func (*PageUpdate) SaveX

func (pu *PageUpdate) SaveX(ctx context.Context) int

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

func (*PageUpdate) SetContent

func (pu *PageUpdate) SetContent(s string) *PageUpdate

SetContent sets the "content" field.

func (*PageUpdate) SetContentHTML

func (pu *PageUpdate) SetContentHTML(s string) *PageUpdate

SetContentHTML sets the "content_html" field.

func (*PageUpdate) SetDeletedAt

func (pu *PageUpdate) SetDeletedAt(t time.Time) *PageUpdate

SetDeletedAt sets the "deleted_at" field.

func (*PageUpdate) SetDraft

func (pu *PageUpdate) SetDraft(b bool) *PageUpdate

SetDraft sets the "draft" field.

func (*PageUpdate) SetFeaturedImage

func (pu *PageUpdate) SetFeaturedImage(f *File) *PageUpdate

SetFeaturedImage sets the "featured_image" edge to the File entity.

func (*PageUpdate) SetFeaturedImageID

func (pu *PageUpdate) SetFeaturedImageID(i int) *PageUpdate

SetFeaturedImageID sets the "featured_image_id" field.

func (*PageUpdate) SetName

func (pu *PageUpdate) SetName(s string) *PageUpdate

SetName sets the "name" field.

func (*PageUpdate) SetNillableDeletedAt

func (pu *PageUpdate) SetNillableDeletedAt(t *time.Time) *PageUpdate

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

func (*PageUpdate) SetNillableDraft

func (pu *PageUpdate) SetNillableDraft(b *bool) *PageUpdate

SetNillableDraft sets the "draft" field if the given value is not nil.

func (*PageUpdate) SetNillableFeaturedImageID

func (pu *PageUpdate) SetNillableFeaturedImageID(i *int) *PageUpdate

SetNillableFeaturedImageID sets the "featured_image_id" field if the given value is not nil.

func (*PageUpdate) SetSlug

func (pu *PageUpdate) SetSlug(s string) *PageUpdate

SetSlug sets the "slug" field.

func (*PageUpdate) SetUpdatedAt

func (pu *PageUpdate) SetUpdatedAt(t time.Time) *PageUpdate

SetUpdatedAt sets the "updated_at" field.

func (*PageUpdate) Where

func (pu *PageUpdate) Where(ps ...predicate.Page) *PageUpdate

Where appends a list predicates to the PageUpdate builder.

type PageUpdateOne

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

PageUpdateOne is the builder for updating a single Page entity.

func (*PageUpdateOne) ClearDeletedAt

func (puo *PageUpdateOne) ClearDeletedAt() *PageUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PageUpdateOne) ClearDraft

func (puo *PageUpdateOne) ClearDraft() *PageUpdateOne

ClearDraft clears the value of the "draft" field.

func (*PageUpdateOne) ClearFeaturedImage

func (puo *PageUpdateOne) ClearFeaturedImage() *PageUpdateOne

ClearFeaturedImage clears the "featured_image" edge to the File entity.

func (*PageUpdateOne) ClearFeaturedImageID

func (puo *PageUpdateOne) ClearFeaturedImageID() *PageUpdateOne

ClearFeaturedImageID clears the value of the "featured_image_id" field.

func (*PageUpdateOne) Exec

func (puo *PageUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PageUpdateOne) ExecX

func (puo *PageUpdateOne) ExecX(ctx context.Context)

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

func (*PageUpdateOne) Mutation

func (puo *PageUpdateOne) Mutation() *PageMutation

Mutation returns the PageMutation object of the builder.

func (*PageUpdateOne) Save

func (puo *PageUpdateOne) Save(ctx context.Context) (*Page, error)

Save executes the query and returns the updated Page entity.

func (*PageUpdateOne) SaveX

func (puo *PageUpdateOne) SaveX(ctx context.Context) *Page

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

func (*PageUpdateOne) Select

func (puo *PageUpdateOne) Select(field string, fields ...string) *PageUpdateOne

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

func (*PageUpdateOne) SetContent

func (puo *PageUpdateOne) SetContent(s string) *PageUpdateOne

SetContent sets the "content" field.

func (*PageUpdateOne) SetContentHTML

func (puo *PageUpdateOne) SetContentHTML(s string) *PageUpdateOne

SetContentHTML sets the "content_html" field.

func (*PageUpdateOne) SetDeletedAt

func (puo *PageUpdateOne) SetDeletedAt(t time.Time) *PageUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*PageUpdateOne) SetDraft

func (puo *PageUpdateOne) SetDraft(b bool) *PageUpdateOne

SetDraft sets the "draft" field.

func (*PageUpdateOne) SetFeaturedImage

func (puo *PageUpdateOne) SetFeaturedImage(f *File) *PageUpdateOne

SetFeaturedImage sets the "featured_image" edge to the File entity.

func (*PageUpdateOne) SetFeaturedImageID

func (puo *PageUpdateOne) SetFeaturedImageID(i int) *PageUpdateOne

SetFeaturedImageID sets the "featured_image_id" field.

func (*PageUpdateOne) SetName

func (puo *PageUpdateOne) SetName(s string) *PageUpdateOne

SetName sets the "name" field.

func (*PageUpdateOne) SetNillableDeletedAt

func (puo *PageUpdateOne) SetNillableDeletedAt(t *time.Time) *PageUpdateOne

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

func (*PageUpdateOne) SetNillableDraft

func (puo *PageUpdateOne) SetNillableDraft(b *bool) *PageUpdateOne

SetNillableDraft sets the "draft" field if the given value is not nil.

func (*PageUpdateOne) SetNillableFeaturedImageID

func (puo *PageUpdateOne) SetNillableFeaturedImageID(i *int) *PageUpdateOne

SetNillableFeaturedImageID sets the "featured_image_id" field if the given value is not nil.

func (*PageUpdateOne) SetSlug

func (puo *PageUpdateOne) SetSlug(s string) *PageUpdateOne

SetSlug sets the "slug" field.

func (*PageUpdateOne) SetUpdatedAt

func (puo *PageUpdateOne) SetUpdatedAt(t time.Time) *PageUpdateOne

SetUpdatedAt sets the "updated_at" field.

type PageUpsert

type PageUpsert struct {
	*sql.UpdateSet
}

PageUpsert is the "OnConflict" setter.

func (*PageUpsert) ClearDeletedAt

func (u *PageUpsert) ClearDeletedAt() *PageUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PageUpsert) ClearDraft

func (u *PageUpsert) ClearDraft() *PageUpsert

ClearDraft clears the value of the "draft" field.

func (*PageUpsert) ClearFeaturedImageID

func (u *PageUpsert) ClearFeaturedImageID() *PageUpsert

ClearFeaturedImageID clears the value of the "featured_image_id" field.

func (*PageUpsert) SetContent

func (u *PageUpsert) SetContent(v string) *PageUpsert

SetContent sets the "content" field.

func (*PageUpsert) SetContentHTML

func (u *PageUpsert) SetContentHTML(v string) *PageUpsert

SetContentHTML sets the "content_html" field.

func (*PageUpsert) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*PageUpsert) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*PageUpsert) SetDraft

func (u *PageUpsert) SetDraft(v bool) *PageUpsert

SetDraft sets the "draft" field.

func (*PageUpsert) SetFeaturedImageID

func (u *PageUpsert) SetFeaturedImageID(v int) *PageUpsert

SetFeaturedImageID sets the "featured_image_id" field.

func (*PageUpsert) SetName

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

SetName sets the "name" field.

func (*PageUpsert) SetSlug

func (u *PageUpsert) SetSlug(v string) *PageUpsert

SetSlug sets the "slug" field.

func (*PageUpsert) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*PageUpsert) UpdateContent

func (u *PageUpsert) UpdateContent() *PageUpsert

UpdateContent sets the "content" field to the value that was provided on create.

func (*PageUpsert) UpdateContentHTML

func (u *PageUpsert) UpdateContentHTML() *PageUpsert

UpdateContentHTML sets the "content_html" field to the value that was provided on create.

func (*PageUpsert) UpdateCreatedAt

func (u *PageUpsert) UpdateCreatedAt() *PageUpsert

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

func (*PageUpsert) UpdateDeletedAt

func (u *PageUpsert) UpdateDeletedAt() *PageUpsert

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

func (*PageUpsert) UpdateDraft

func (u *PageUpsert) UpdateDraft() *PageUpsert

UpdateDraft sets the "draft" field to the value that was provided on create.

func (*PageUpsert) UpdateFeaturedImageID

func (u *PageUpsert) UpdateFeaturedImageID() *PageUpsert

UpdateFeaturedImageID sets the "featured_image_id" field to the value that was provided on create.

func (*PageUpsert) UpdateName

func (u *PageUpsert) UpdateName() *PageUpsert

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

func (*PageUpsert) UpdateSlug

func (u *PageUpsert) UpdateSlug() *PageUpsert

UpdateSlug sets the "slug" field to the value that was provided on create.

func (*PageUpsert) UpdateUpdatedAt

func (u *PageUpsert) UpdateUpdatedAt() *PageUpsert

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

type PageUpsertBulk

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

PageUpsertBulk is the builder for "upsert"-ing a bulk of Page nodes.

func (*PageUpsertBulk) ClearDeletedAt

func (u *PageUpsertBulk) ClearDeletedAt() *PageUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PageUpsertBulk) ClearDraft

func (u *PageUpsertBulk) ClearDraft() *PageUpsertBulk

ClearDraft clears the value of the "draft" field.

func (*PageUpsertBulk) ClearFeaturedImageID

func (u *PageUpsertBulk) ClearFeaturedImageID() *PageUpsertBulk

ClearFeaturedImageID clears the value of the "featured_image_id" field.

func (*PageUpsertBulk) DoNothing

func (u *PageUpsertBulk) DoNothing() *PageUpsertBulk

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

func (*PageUpsertBulk) Exec

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

Exec executes the query.

func (*PageUpsertBulk) ExecX

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

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

func (*PageUpsertBulk) Ignore

func (u *PageUpsertBulk) Ignore() *PageUpsertBulk

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

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

func (*PageUpsertBulk) SetContent

func (u *PageUpsertBulk) SetContent(v string) *PageUpsertBulk

SetContent sets the "content" field.

func (*PageUpsertBulk) SetContentHTML

func (u *PageUpsertBulk) SetContentHTML(v string) *PageUpsertBulk

SetContentHTML sets the "content_html" field.

func (*PageUpsertBulk) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*PageUpsertBulk) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*PageUpsertBulk) SetDraft

func (u *PageUpsertBulk) SetDraft(v bool) *PageUpsertBulk

SetDraft sets the "draft" field.

func (*PageUpsertBulk) SetFeaturedImageID

func (u *PageUpsertBulk) SetFeaturedImageID(v int) *PageUpsertBulk

SetFeaturedImageID sets the "featured_image_id" field.

func (*PageUpsertBulk) SetName

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

SetName sets the "name" field.

func (*PageUpsertBulk) SetSlug

func (u *PageUpsertBulk) SetSlug(v string) *PageUpsertBulk

SetSlug sets the "slug" field.

func (*PageUpsertBulk) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*PageUpsertBulk) Update

func (u *PageUpsertBulk) Update(set func(*PageUpsert)) *PageUpsertBulk

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

func (*PageUpsertBulk) UpdateContent

func (u *PageUpsertBulk) UpdateContent() *PageUpsertBulk

UpdateContent sets the "content" field to the value that was provided on create.

func (*PageUpsertBulk) UpdateContentHTML

func (u *PageUpsertBulk) UpdateContentHTML() *PageUpsertBulk

UpdateContentHTML sets the "content_html" field to the value that was provided on create.

func (*PageUpsertBulk) UpdateCreatedAt

func (u *PageUpsertBulk) UpdateCreatedAt() *PageUpsertBulk

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

func (*PageUpsertBulk) UpdateDeletedAt

func (u *PageUpsertBulk) UpdateDeletedAt() *PageUpsertBulk

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

func (*PageUpsertBulk) UpdateDraft

func (u *PageUpsertBulk) UpdateDraft() *PageUpsertBulk

UpdateDraft sets the "draft" field to the value that was provided on create.

func (*PageUpsertBulk) UpdateFeaturedImageID

func (u *PageUpsertBulk) UpdateFeaturedImageID() *PageUpsertBulk

UpdateFeaturedImageID sets the "featured_image_id" field to the value that was provided on create.

func (*PageUpsertBulk) UpdateName

func (u *PageUpsertBulk) UpdateName() *PageUpsertBulk

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

func (*PageUpsertBulk) UpdateNewValues

func (u *PageUpsertBulk) UpdateNewValues() *PageUpsertBulk

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

client.Page.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*PageUpsertBulk) UpdateSlug

func (u *PageUpsertBulk) UpdateSlug() *PageUpsertBulk

UpdateSlug sets the "slug" field to the value that was provided on create.

func (*PageUpsertBulk) UpdateUpdatedAt

func (u *PageUpsertBulk) UpdateUpdatedAt() *PageUpsertBulk

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

type PageUpsertOne

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

PageUpsertOne is the builder for "upsert"-ing

one Page node.

func (*PageUpsertOne) ClearDeletedAt

func (u *PageUpsertOne) ClearDeletedAt() *PageUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PageUpsertOne) ClearDraft

func (u *PageUpsertOne) ClearDraft() *PageUpsertOne

ClearDraft clears the value of the "draft" field.

func (*PageUpsertOne) ClearFeaturedImageID

func (u *PageUpsertOne) ClearFeaturedImageID() *PageUpsertOne

ClearFeaturedImageID clears the value of the "featured_image_id" field.

func (*PageUpsertOne) DoNothing

func (u *PageUpsertOne) DoNothing() *PageUpsertOne

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

func (*PageUpsertOne) Exec

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

Exec executes the query.

func (*PageUpsertOne) ExecX

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

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

func (*PageUpsertOne) ID

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

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

func (*PageUpsertOne) IDX

func (u *PageUpsertOne) IDX(ctx context.Context) int

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

func (*PageUpsertOne) Ignore

func (u *PageUpsertOne) Ignore() *PageUpsertOne

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

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

func (*PageUpsertOne) SetContent

func (u *PageUpsertOne) SetContent(v string) *PageUpsertOne

SetContent sets the "content" field.

func (*PageUpsertOne) SetContentHTML

func (u *PageUpsertOne) SetContentHTML(v string) *PageUpsertOne

SetContentHTML sets the "content_html" field.

func (*PageUpsertOne) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*PageUpsertOne) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*PageUpsertOne) SetDraft

func (u *PageUpsertOne) SetDraft(v bool) *PageUpsertOne

SetDraft sets the "draft" field.

func (*PageUpsertOne) SetFeaturedImageID

func (u *PageUpsertOne) SetFeaturedImageID(v int) *PageUpsertOne

SetFeaturedImageID sets the "featured_image_id" field.

func (*PageUpsertOne) SetName

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

SetName sets the "name" field.

func (*PageUpsertOne) SetSlug

func (u *PageUpsertOne) SetSlug(v string) *PageUpsertOne

SetSlug sets the "slug" field.

func (*PageUpsertOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*PageUpsertOne) Update

func (u *PageUpsertOne) Update(set func(*PageUpsert)) *PageUpsertOne

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

func (*PageUpsertOne) UpdateContent

func (u *PageUpsertOne) UpdateContent() *PageUpsertOne

UpdateContent sets the "content" field to the value that was provided on create.

func (*PageUpsertOne) UpdateContentHTML

func (u *PageUpsertOne) UpdateContentHTML() *PageUpsertOne

UpdateContentHTML sets the "content_html" field to the value that was provided on create.

func (*PageUpsertOne) UpdateCreatedAt

func (u *PageUpsertOne) UpdateCreatedAt() *PageUpsertOne

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

func (*PageUpsertOne) UpdateDeletedAt

func (u *PageUpsertOne) UpdateDeletedAt() *PageUpsertOne

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

func (*PageUpsertOne) UpdateDraft

func (u *PageUpsertOne) UpdateDraft() *PageUpsertOne

UpdateDraft sets the "draft" field to the value that was provided on create.

func (*PageUpsertOne) UpdateFeaturedImageID

func (u *PageUpsertOne) UpdateFeaturedImageID() *PageUpsertOne

UpdateFeaturedImageID sets the "featured_image_id" field to the value that was provided on create.

func (*PageUpsertOne) UpdateName

func (u *PageUpsertOne) UpdateName() *PageUpsertOne

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

func (*PageUpsertOne) UpdateNewValues

func (u *PageUpsertOne) UpdateNewValues() *PageUpsertOne

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

client.Page.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*PageUpsertOne) UpdateSlug

func (u *PageUpsertOne) UpdateSlug() *PageUpsertOne

UpdateSlug sets the "slug" field to the value that was provided on create.

func (*PageUpsertOne) UpdateUpdatedAt

func (u *PageUpsertOne) UpdateUpdatedAt() *PageUpsertOne

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

type Pages

type Pages []*Page

Pages is a parsable slice of Page.

type Permission

type Permission struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt time.Time `json:"omitempty"`
	// RoleID holds the value of the "role_id" field.
	RoleID int `json:"role_id,omitempty"`
	// Action holds the value of the "action" field.
	Action string `json:"action,omitempty" validate:"max=255"`
	// Value holds the value of the "value" field.
	// all | own | none
	Value string `json:"value,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the PermissionQuery when eager-loading is set.
	Edges PermissionEdges `json:"edges"`
	// contains filtered or unexported fields
}

Permission is the model entity for the Permission schema.

func (*Permission) QueryRole

func (pe *Permission) QueryRole() *RoleQuery

QueryRole queries the "role" edge of the Permission entity.

func (*Permission) String

func (pe *Permission) String() string

String implements the fmt.Stringer.

func (*Permission) Unwrap

func (pe *Permission) Unwrap() *Permission

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

func (pe *Permission) Update() *PermissionUpdateOne

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

type PermissionClient

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

PermissionClient is a client for the Permission schema.

func NewPermissionClient

func NewPermissionClient(c config) *PermissionClient

NewPermissionClient returns a client for the Permission from the given config.

func (*PermissionClient) Create

func (c *PermissionClient) Create() *PermissionCreate

Create returns a create builder for Permission.

func (*PermissionClient) CreateBulk

func (c *PermissionClient) CreateBulk(builders ...*PermissionCreate) *PermissionCreateBulk

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

func (*PermissionClient) Delete

func (c *PermissionClient) Delete() *PermissionDelete

Delete returns a delete builder for Permission.

func (*PermissionClient) DeleteOne

func (c *PermissionClient) DeleteOne(pe *Permission) *PermissionDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*PermissionClient) DeleteOneID

func (c *PermissionClient) DeleteOneID(id int) *PermissionDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*PermissionClient) Get

func (c *PermissionClient) Get(ctx context.Context, id int) (*Permission, error)

Get returns a Permission entity by its id.

func (*PermissionClient) GetX

func (c *PermissionClient) GetX(ctx context.Context, id int) *Permission

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

func (*PermissionClient) Hooks

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

Hooks returns the client hooks.

func (*PermissionClient) Query

func (c *PermissionClient) Query() *PermissionQuery

Query returns a query builder for Permission.

func (*PermissionClient) QueryRole

func (c *PermissionClient) QueryRole(pe *Permission) *RoleQuery

QueryRole queries the role edge of a Permission.

func (*PermissionClient) Update

func (c *PermissionClient) Update() *PermissionUpdate

Update returns an update builder for Permission.

func (*PermissionClient) UpdateOne

func (c *PermissionClient) UpdateOne(pe *Permission) *PermissionUpdateOne

UpdateOne returns an update builder for the given entity.

func (*PermissionClient) UpdateOneID

func (c *PermissionClient) UpdateOneID(id int) *PermissionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*PermissionClient) Use

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

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

type PermissionCreate

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

PermissionCreate is the builder for creating a Permission entity.

func (*PermissionCreate) Exec

func (pc *PermissionCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*PermissionCreate) ExecX

func (pc *PermissionCreate) ExecX(ctx context.Context)

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

func (*PermissionCreate) Mutation

func (pc *PermissionCreate) Mutation() *PermissionMutation

Mutation returns the PermissionMutation object of the builder.

func (*PermissionCreate) OnConflict

func (pc *PermissionCreate) OnConflict(opts ...sql.ConflictOption) *PermissionUpsertOne

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

client.Permission.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.PermissionUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*PermissionCreate) OnConflictColumns

func (pc *PermissionCreate) OnConflictColumns(columns ...string) *PermissionUpsertOne

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

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

func (*PermissionCreate) Save

func (pc *PermissionCreate) Save(ctx context.Context) (*Permission, error)

Save creates the Permission in the database.

func (*PermissionCreate) SaveX

func (pc *PermissionCreate) SaveX(ctx context.Context) *Permission

SaveX calls Save and panics if Save returns an error.

func (*PermissionCreate) SetAction

func (pc *PermissionCreate) SetAction(s string) *PermissionCreate

SetAction sets the "action" field.

func (*PermissionCreate) SetCreatedAt

func (pc *PermissionCreate) SetCreatedAt(t time.Time) *PermissionCreate

SetCreatedAt sets the "created_at" field.

func (*PermissionCreate) SetDeletedAt

func (pc *PermissionCreate) SetDeletedAt(t time.Time) *PermissionCreate

SetDeletedAt sets the "deleted_at" field.

func (*PermissionCreate) SetNillableCreatedAt

func (pc *PermissionCreate) SetNillableCreatedAt(t *time.Time) *PermissionCreate

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

func (*PermissionCreate) SetNillableDeletedAt

func (pc *PermissionCreate) SetNillableDeletedAt(t *time.Time) *PermissionCreate

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

func (*PermissionCreate) SetNillableUpdatedAt

func (pc *PermissionCreate) SetNillableUpdatedAt(t *time.Time) *PermissionCreate

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

func (*PermissionCreate) SetRole

func (pc *PermissionCreate) SetRole(r *Role) *PermissionCreate

SetRole sets the "role" edge to the Role entity.

func (*PermissionCreate) SetRoleID

func (pc *PermissionCreate) SetRoleID(i int) *PermissionCreate

SetRoleID sets the "role_id" field.

func (*PermissionCreate) SetUpdatedAt

func (pc *PermissionCreate) SetUpdatedAt(t time.Time) *PermissionCreate

SetUpdatedAt sets the "updated_at" field.

func (*PermissionCreate) SetValue

func (pc *PermissionCreate) SetValue(s string) *PermissionCreate

SetValue sets the "value" field.

type PermissionCreateBulk

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

PermissionCreateBulk is the builder for creating many Permission entities in bulk.

func (*PermissionCreateBulk) Exec

func (pcb *PermissionCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*PermissionCreateBulk) ExecX

func (pcb *PermissionCreateBulk) ExecX(ctx context.Context)

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

func (*PermissionCreateBulk) OnConflict

func (pcb *PermissionCreateBulk) OnConflict(opts ...sql.ConflictOption) *PermissionUpsertBulk

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

client.Permission.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.PermissionUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*PermissionCreateBulk) OnConflictColumns

func (pcb *PermissionCreateBulk) OnConflictColumns(columns ...string) *PermissionUpsertBulk

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

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

func (*PermissionCreateBulk) Save

func (pcb *PermissionCreateBulk) Save(ctx context.Context) ([]*Permission, error)

Save creates the Permission entities in the database.

func (*PermissionCreateBulk) SaveX

func (pcb *PermissionCreateBulk) SaveX(ctx context.Context) []*Permission

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

type PermissionDelete

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

PermissionDelete is the builder for deleting a Permission entity.

func (*PermissionDelete) Exec

func (pd *PermissionDelete) Exec(ctx context.Context) (int, error)

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

func (*PermissionDelete) ExecX

func (pd *PermissionDelete) ExecX(ctx context.Context) int

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

func (*PermissionDelete) Where

Where appends a list predicates to the PermissionDelete builder.

type PermissionDeleteOne

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

PermissionDeleteOne is the builder for deleting a single Permission entity.

func (*PermissionDeleteOne) Exec

func (pdo *PermissionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*PermissionDeleteOne) ExecX

func (pdo *PermissionDeleteOne) ExecX(ctx context.Context)

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

type PermissionEdges

type PermissionEdges struct {
	// Role holds the value of the role edge.
	Role *Role `json:"role,omitempty"`
	// contains filtered or unexported fields
}

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

func (PermissionEdges) RoleOrErr

func (e PermissionEdges) RoleOrErr() (*Role, error)

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

type PermissionFilter

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

PermissionFilter provides a generic filtering capability at runtime for PermissionQuery.

func (*PermissionFilter) Where

func (f *PermissionFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*PermissionFilter) WhereAction

func (f *PermissionFilter) WhereAction(p entql.StringP)

WhereAction applies the entql string predicate on the action field.

func (*PermissionFilter) WhereCreatedAt

func (f *PermissionFilter) WhereCreatedAt(p entql.TimeP)

WhereCreatedAt applies the entql time.Time predicate on the created_at field.

func (*PermissionFilter) WhereDeletedAt

func (f *PermissionFilter) WhereDeletedAt(p entql.TimeP)

WhereDeletedAt applies the entql time.Time predicate on the deleted_at field.

func (*PermissionFilter) WhereHasRole

func (f *PermissionFilter) WhereHasRole()

WhereHasRole applies a predicate to check if query has an edge role.

func (*PermissionFilter) WhereHasRoleWith

func (f *PermissionFilter) WhereHasRoleWith(preds ...predicate.Role)

WhereHasRoleWith applies a predicate to check if query has an edge role with a given conditions (other predicates).

func (*PermissionFilter) WhereID

func (f *PermissionFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*PermissionFilter) WhereRoleID

func (f *PermissionFilter) WhereRoleID(p entql.IntP)

WhereRoleID applies the entql int predicate on the role_id field.

func (*PermissionFilter) WhereUpdatedAt

func (f *PermissionFilter) WhereUpdatedAt(p entql.TimeP)

WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.

func (*PermissionFilter) WhereValue

func (f *PermissionFilter) WhereValue(p entql.StringP)

WhereValue applies the entql string predicate on the value field.

type PermissionGroupBy

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

PermissionGroupBy is the group-by builder for Permission entities.

func (*PermissionGroupBy) Aggregate

func (pgb *PermissionGroupBy) Aggregate(fns ...AggregateFunc) *PermissionGroupBy

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

func (*PermissionGroupBy) Bool

func (pgb *PermissionGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) BoolX

func (pgb *PermissionGroupBy) BoolX(ctx context.Context) bool

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

func (*PermissionGroupBy) Bools

func (pgb *PermissionGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) BoolsX

func (pgb *PermissionGroupBy) BoolsX(ctx context.Context) []bool

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

func (*PermissionGroupBy) Float64

func (pgb *PermissionGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) Float64X

func (pgb *PermissionGroupBy) Float64X(ctx context.Context) float64

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

func (*PermissionGroupBy) Float64s

func (pgb *PermissionGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) Float64sX

func (pgb *PermissionGroupBy) Float64sX(ctx context.Context) []float64

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

func (*PermissionGroupBy) Int

func (pgb *PermissionGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) IntX

func (pgb *PermissionGroupBy) IntX(ctx context.Context) int

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

func (*PermissionGroupBy) Ints

func (pgb *PermissionGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) IntsX

func (pgb *PermissionGroupBy) IntsX(ctx context.Context) []int

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

func (*PermissionGroupBy) Scan

func (pgb *PermissionGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*PermissionGroupBy) ScanX

func (pgb *PermissionGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*PermissionGroupBy) String

func (pgb *PermissionGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) StringX

func (pgb *PermissionGroupBy) StringX(ctx context.Context) string

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

func (*PermissionGroupBy) Strings

func (pgb *PermissionGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*PermissionGroupBy) StringsX

func (pgb *PermissionGroupBy) StringsX(ctx context.Context) []string

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

type PermissionMutation

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

PermissionMutation represents an operation that mutates the Permission nodes in the graph.

func (*PermissionMutation) Action

func (m *PermissionMutation) Action() (r string, exists bool)

Action returns the value of the "action" field in the mutation.

func (*PermissionMutation) AddField

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

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

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

func (*PermissionMutation) AddedField

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

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

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

func (*PermissionMutation) AddedIDs

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

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

func (*PermissionMutation) ClearDeletedAt

func (m *PermissionMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PermissionMutation) ClearEdge

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

func (m *PermissionMutation) 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 (*PermissionMutation) ClearRole

func (m *PermissionMutation) ClearRole()

ClearRole clears the "role" edge to the Role entity.

func (*PermissionMutation) ClearedEdges

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

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

func (*PermissionMutation) ClearedFields

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

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

func (PermissionMutation) Client

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

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

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

func (*PermissionMutation) DeletedAt

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

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

func (*PermissionMutation) DeletedAtCleared

func (m *PermissionMutation) DeletedAtCleared() bool

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

func (*PermissionMutation) EdgeCleared

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

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

func (*PermissionMutation) Field

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

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

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

func (*PermissionMutation) Fields

func (m *PermissionMutation) 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 (*PermissionMutation) Filter

func (m *PermissionMutation) Filter() *PermissionFilter

Filter returns an entql.Where implementation to apply filters on the PermissionMutation builder.

func (*PermissionMutation) ID

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

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

func (*PermissionMutation) IDs

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

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

func (*PermissionMutation) OldAction

func (m *PermissionMutation) OldAction(ctx context.Context) (v string, err error)

OldAction returns the old "action" field's value of the Permission entity. If the Permission 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 (*PermissionMutation) OldCreatedAt

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

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

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

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

func (m *PermissionMutation) 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 (*PermissionMutation) OldRoleID

func (m *PermissionMutation) OldRoleID(ctx context.Context) (v int, err error)

OldRoleID returns the old "role_id" field's value of the Permission entity. If the Permission 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 (*PermissionMutation) OldUpdatedAt

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

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

func (m *PermissionMutation) OldValue(ctx context.Context) (v string, err error)

OldValue returns the old "value" field's value of the Permission entity. If the Permission 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 (*PermissionMutation) Op

func (m *PermissionMutation) Op() Op

Op returns the operation name.

func (*PermissionMutation) RemovedEdges

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

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

func (*PermissionMutation) RemovedIDs

func (m *PermissionMutation) 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 (*PermissionMutation) ResetAction

func (m *PermissionMutation) ResetAction()

ResetAction resets all changes to the "action" field.

func (*PermissionMutation) ResetCreatedAt

func (m *PermissionMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*PermissionMutation) ResetDeletedAt

func (m *PermissionMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*PermissionMutation) ResetEdge

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

func (m *PermissionMutation) 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 (*PermissionMutation) ResetRole

func (m *PermissionMutation) ResetRole()

ResetRole resets all changes to the "role" edge.

func (*PermissionMutation) ResetRoleID

func (m *PermissionMutation) ResetRoleID()

ResetRoleID resets all changes to the "role_id" field.

func (*PermissionMutation) ResetUpdatedAt

func (m *PermissionMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*PermissionMutation) ResetValue

func (m *PermissionMutation) ResetValue()

ResetValue resets all changes to the "value" field.

func (*PermissionMutation) RoleCleared

func (m *PermissionMutation) RoleCleared() bool

RoleCleared reports if the "role" edge to the Role entity was cleared.

func (*PermissionMutation) RoleID

func (m *PermissionMutation) RoleID() (r int, exists bool)

RoleID returns the value of the "role_id" field in the mutation.

func (*PermissionMutation) RoleIDs

func (m *PermissionMutation) RoleIDs() (ids []int)

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

func (*PermissionMutation) SetAction

func (m *PermissionMutation) SetAction(s string)

SetAction sets the "action" field.

func (*PermissionMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*PermissionMutation) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*PermissionMutation) SetField

func (m *PermissionMutation) 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 (*PermissionMutation) SetRoleID

func (m *PermissionMutation) SetRoleID(i int)

SetRoleID sets the "role_id" field.

func (*PermissionMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*PermissionMutation) SetValue

func (m *PermissionMutation) SetValue(s string)

SetValue sets the "value" field.

func (PermissionMutation) Tx

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

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

func (*PermissionMutation) Type

func (m *PermissionMutation) Type() string

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

func (*PermissionMutation) UpdatedAt

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

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

func (*PermissionMutation) Value

func (m *PermissionMutation) Value() (r string, exists bool)

Value returns the value of the "value" field in the mutation.

func (*PermissionMutation) Where

func (m *PermissionMutation) Where(ps ...predicate.Permission)

Where appends a list predicates to the PermissionMutation builder.

type PermissionQuery

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

PermissionQuery is the builder for querying Permission entities.

func (*PermissionQuery) All

func (pq *PermissionQuery) All(ctx context.Context) ([]*Permission, error)

All executes the query and returns a list of Permissions.

func (*PermissionQuery) AllX

func (pq *PermissionQuery) AllX(ctx context.Context) []*Permission

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

func (*PermissionQuery) Clone

func (pq *PermissionQuery) Clone() *PermissionQuery

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

func (*PermissionQuery) Count

func (pq *PermissionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*PermissionQuery) CountX

func (pq *PermissionQuery) CountX(ctx context.Context) int

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

func (*PermissionQuery) Exist

func (pq *PermissionQuery) Exist(ctx context.Context) (bool, error)

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

func (*PermissionQuery) ExistX

func (pq *PermissionQuery) ExistX(ctx context.Context) bool

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

func (*PermissionQuery) Filter

func (pq *PermissionQuery) Filter() *PermissionFilter

Filter returns a Filter implementation to apply filters on the PermissionQuery builder.

func (*PermissionQuery) First

func (pq *PermissionQuery) First(ctx context.Context) (*Permission, error)

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

func (*PermissionQuery) FirstID

func (pq *PermissionQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*PermissionQuery) FirstIDX

func (pq *PermissionQuery) FirstIDX(ctx context.Context) int

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

func (*PermissionQuery) FirstX

func (pq *PermissionQuery) FirstX(ctx context.Context) *Permission

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

func (*PermissionQuery) GroupBy

func (pq *PermissionQuery) GroupBy(field string, fields ...string) *PermissionGroupBy

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

client.Permission.Query().
	GroupBy(permission.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PermissionQuery) IDs

func (pq *PermissionQuery) IDs(ctx context.Context) ([]int, error)

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

func (*PermissionQuery) IDsX

func (pq *PermissionQuery) IDsX(ctx context.Context) []int

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

func (*PermissionQuery) Limit

func (pq *PermissionQuery) Limit(limit int) *PermissionQuery

Limit adds a limit step to the query.

func (*PermissionQuery) Offset

func (pq *PermissionQuery) Offset(offset int) *PermissionQuery

Offset adds an offset step to the query.

func (*PermissionQuery) Only

func (pq *PermissionQuery) Only(ctx context.Context) (*Permission, error)

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

func (*PermissionQuery) OnlyID

func (pq *PermissionQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*PermissionQuery) OnlyIDX

func (pq *PermissionQuery) OnlyIDX(ctx context.Context) int

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

func (*PermissionQuery) OnlyX

func (pq *PermissionQuery) OnlyX(ctx context.Context) *Permission

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

func (*PermissionQuery) Order

func (pq *PermissionQuery) Order(o ...OrderFunc) *PermissionQuery

Order adds an order step to the query.

func (*PermissionQuery) QueryRole

func (pq *PermissionQuery) QueryRole() *RoleQuery

QueryRole chains the current query on the "role" edge.

func (*PermissionQuery) Select

func (pq *PermissionQuery) Select(fields ...string) *PermissionSelect

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:"omitempty"`
}

client.Permission.Query().
	Select(permission.FieldCreatedAt).
	Scan(ctx, &v)

func (*PermissionQuery) Unique

func (pq *PermissionQuery) Unique(unique bool) *PermissionQuery

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

Where adds a new predicate for the PermissionQuery builder.

func (*PermissionQuery) WithRole

func (pq *PermissionQuery) WithRole(opts ...func(*RoleQuery)) *PermissionQuery

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

type PermissionSelect

type PermissionSelect struct {
	*PermissionQuery
	// contains filtered or unexported fields
}

PermissionSelect is the builder for selecting fields of Permission entities.

func (*PermissionSelect) Bool

func (ps *PermissionSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*PermissionSelect) BoolX

func (ps *PermissionSelect) BoolX(ctx context.Context) bool

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

func (*PermissionSelect) Bools

func (ps *PermissionSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*PermissionSelect) BoolsX

func (ps *PermissionSelect) BoolsX(ctx context.Context) []bool

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

func (*PermissionSelect) Float64

func (ps *PermissionSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*PermissionSelect) Float64X

func (ps *PermissionSelect) Float64X(ctx context.Context) float64

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

func (*PermissionSelect) Float64s

func (ps *PermissionSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*PermissionSelect) Float64sX

func (ps *PermissionSelect) Float64sX(ctx context.Context) []float64

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

func (*PermissionSelect) Int

func (ps *PermissionSelect) Int(ctx context.Context) (_ int, err error)

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

func (*PermissionSelect) IntX

func (ps *PermissionSelect) IntX(ctx context.Context) int

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

func (*PermissionSelect) Ints

func (ps *PermissionSelect) Ints(ctx context.Context) ([]int, error)

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

func (*PermissionSelect) IntsX

func (ps *PermissionSelect) IntsX(ctx context.Context) []int

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

func (*PermissionSelect) Scan

func (ps *PermissionSelect) Scan(ctx context.Context, v interface{}) error

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

func (*PermissionSelect) ScanX

func (ps *PermissionSelect) ScanX(ctx context.Context, v interface{})

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

func (*PermissionSelect) String

func (ps *PermissionSelect) String(ctx context.Context) (_ string, err error)

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

func (*PermissionSelect) StringX

func (ps *PermissionSelect) StringX(ctx context.Context) string

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

func (*PermissionSelect) Strings

func (ps *PermissionSelect) Strings(ctx context.Context) ([]string, error)

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

func (*PermissionSelect) StringsX

func (ps *PermissionSelect) StringsX(ctx context.Context) []string

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

type PermissionUpdate

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

PermissionUpdate is the builder for updating Permission entities.

func (*PermissionUpdate) ClearDeletedAt

func (pu *PermissionUpdate) ClearDeletedAt() *PermissionUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PermissionUpdate) ClearRole

func (pu *PermissionUpdate) ClearRole() *PermissionUpdate

ClearRole clears the "role" edge to the Role entity.

func (*PermissionUpdate) Exec

func (pu *PermissionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*PermissionUpdate) ExecX

func (pu *PermissionUpdate) ExecX(ctx context.Context)

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

func (*PermissionUpdate) Mutation

func (pu *PermissionUpdate) Mutation() *PermissionMutation

Mutation returns the PermissionMutation object of the builder.

func (*PermissionUpdate) Save

func (pu *PermissionUpdate) Save(ctx context.Context) (int, error)

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

func (*PermissionUpdate) SaveX

func (pu *PermissionUpdate) SaveX(ctx context.Context) int

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

func (*PermissionUpdate) SetAction

func (pu *PermissionUpdate) SetAction(s string) *PermissionUpdate

SetAction sets the "action" field.

func (*PermissionUpdate) SetDeletedAt

func (pu *PermissionUpdate) SetDeletedAt(t time.Time) *PermissionUpdate

SetDeletedAt sets the "deleted_at" field.

func (*PermissionUpdate) SetNillableDeletedAt

func (pu *PermissionUpdate) SetNillableDeletedAt(t *time.Time) *PermissionUpdate

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

func (*PermissionUpdate) SetRole

func (pu *PermissionUpdate) SetRole(r *Role) *PermissionUpdate

SetRole sets the "role" edge to the Role entity.

func (*PermissionUpdate) SetRoleID

func (pu *PermissionUpdate) SetRoleID(i int) *PermissionUpdate

SetRoleID sets the "role_id" field.

func (*PermissionUpdate) SetUpdatedAt

func (pu *PermissionUpdate) SetUpdatedAt(t time.Time) *PermissionUpdate

SetUpdatedAt sets the "updated_at" field.

func (*PermissionUpdate) SetValue

func (pu *PermissionUpdate) SetValue(s string) *PermissionUpdate

SetValue sets the "value" field.

func (*PermissionUpdate) Where

Where appends a list predicates to the PermissionUpdate builder.

type PermissionUpdateOne

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

PermissionUpdateOne is the builder for updating a single Permission entity.

func (*PermissionUpdateOne) ClearDeletedAt

func (puo *PermissionUpdateOne) ClearDeletedAt() *PermissionUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PermissionUpdateOne) ClearRole

func (puo *PermissionUpdateOne) ClearRole() *PermissionUpdateOne

ClearRole clears the "role" edge to the Role entity.

func (*PermissionUpdateOne) Exec

func (puo *PermissionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*PermissionUpdateOne) ExecX

func (puo *PermissionUpdateOne) ExecX(ctx context.Context)

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

func (*PermissionUpdateOne) Mutation

func (puo *PermissionUpdateOne) Mutation() *PermissionMutation

Mutation returns the PermissionMutation object of the builder.

func (*PermissionUpdateOne) Save

func (puo *PermissionUpdateOne) Save(ctx context.Context) (*Permission, error)

Save executes the query and returns the updated Permission entity.

func (*PermissionUpdateOne) SaveX

func (puo *PermissionUpdateOne) SaveX(ctx context.Context) *Permission

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

func (*PermissionUpdateOne) Select

func (puo *PermissionUpdateOne) Select(field string, fields ...string) *PermissionUpdateOne

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

func (*PermissionUpdateOne) SetAction

func (puo *PermissionUpdateOne) SetAction(s string) *PermissionUpdateOne

SetAction sets the "action" field.

func (*PermissionUpdateOne) SetDeletedAt

func (puo *PermissionUpdateOne) SetDeletedAt(t time.Time) *PermissionUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*PermissionUpdateOne) SetNillableDeletedAt

func (puo *PermissionUpdateOne) SetNillableDeletedAt(t *time.Time) *PermissionUpdateOne

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

func (*PermissionUpdateOne) SetRole

func (puo *PermissionUpdateOne) SetRole(r *Role) *PermissionUpdateOne

SetRole sets the "role" edge to the Role entity.

func (*PermissionUpdateOne) SetRoleID

func (puo *PermissionUpdateOne) SetRoleID(i int) *PermissionUpdateOne

SetRoleID sets the "role_id" field.

func (*PermissionUpdateOne) SetUpdatedAt

func (puo *PermissionUpdateOne) SetUpdatedAt(t time.Time) *PermissionUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*PermissionUpdateOne) SetValue

SetValue sets the "value" field.

type PermissionUpsert

type PermissionUpsert struct {
	*sql.UpdateSet
}

PermissionUpsert is the "OnConflict" setter.

func (*PermissionUpsert) ClearDeletedAt

func (u *PermissionUpsert) ClearDeletedAt() *PermissionUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PermissionUpsert) SetAction

func (u *PermissionUpsert) SetAction(v string) *PermissionUpsert

SetAction sets the "action" field.

func (*PermissionUpsert) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*PermissionUpsert) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*PermissionUpsert) SetRoleID

func (u *PermissionUpsert) SetRoleID(v int) *PermissionUpsert

SetRoleID sets the "role_id" field.

func (*PermissionUpsert) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*PermissionUpsert) SetValue

func (u *PermissionUpsert) SetValue(v string) *PermissionUpsert

SetValue sets the "value" field.

func (*PermissionUpsert) UpdateAction

func (u *PermissionUpsert) UpdateAction() *PermissionUpsert

UpdateAction sets the "action" field to the value that was provided on create.

func (*PermissionUpsert) UpdateCreatedAt

func (u *PermissionUpsert) UpdateCreatedAt() *PermissionUpsert

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

func (*PermissionUpsert) UpdateDeletedAt

func (u *PermissionUpsert) UpdateDeletedAt() *PermissionUpsert

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

func (*PermissionUpsert) UpdateRoleID

func (u *PermissionUpsert) UpdateRoleID() *PermissionUpsert

UpdateRoleID sets the "role_id" field to the value that was provided on create.

func (*PermissionUpsert) UpdateUpdatedAt

func (u *PermissionUpsert) UpdateUpdatedAt() *PermissionUpsert

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

func (*PermissionUpsert) UpdateValue

func (u *PermissionUpsert) UpdateValue() *PermissionUpsert

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

type PermissionUpsertBulk

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

PermissionUpsertBulk is the builder for "upsert"-ing a bulk of Permission nodes.

func (*PermissionUpsertBulk) ClearDeletedAt

func (u *PermissionUpsertBulk) ClearDeletedAt() *PermissionUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PermissionUpsertBulk) DoNothing

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

func (*PermissionUpsertBulk) Exec

Exec executes the query.

func (*PermissionUpsertBulk) ExecX

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

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

func (*PermissionUpsertBulk) Ignore

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

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

func (*PermissionUpsertBulk) SetAction

SetAction sets the "action" field.

func (*PermissionUpsertBulk) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*PermissionUpsertBulk) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*PermissionUpsertBulk) SetRoleID

SetRoleID sets the "role_id" field.

func (*PermissionUpsertBulk) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*PermissionUpsertBulk) SetValue

SetValue sets the "value" field.

func (*PermissionUpsertBulk) Update

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

func (*PermissionUpsertBulk) UpdateAction

func (u *PermissionUpsertBulk) UpdateAction() *PermissionUpsertBulk

UpdateAction sets the "action" field to the value that was provided on create.

func (*PermissionUpsertBulk) UpdateCreatedAt

func (u *PermissionUpsertBulk) UpdateCreatedAt() *PermissionUpsertBulk

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

func (*PermissionUpsertBulk) UpdateDeletedAt

func (u *PermissionUpsertBulk) UpdateDeletedAt() *PermissionUpsertBulk

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

func (*PermissionUpsertBulk) UpdateNewValues

func (u *PermissionUpsertBulk) UpdateNewValues() *PermissionUpsertBulk

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

client.Permission.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*PermissionUpsertBulk) UpdateRoleID

func (u *PermissionUpsertBulk) UpdateRoleID() *PermissionUpsertBulk

UpdateRoleID sets the "role_id" field to the value that was provided on create.

func (*PermissionUpsertBulk) UpdateUpdatedAt

func (u *PermissionUpsertBulk) UpdateUpdatedAt() *PermissionUpsertBulk

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

func (*PermissionUpsertBulk) UpdateValue

func (u *PermissionUpsertBulk) UpdateValue() *PermissionUpsertBulk

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

type PermissionUpsertOne

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

PermissionUpsertOne is the builder for "upsert"-ing

one Permission node.

func (*PermissionUpsertOne) ClearDeletedAt

func (u *PermissionUpsertOne) ClearDeletedAt() *PermissionUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PermissionUpsertOne) DoNothing

func (u *PermissionUpsertOne) DoNothing() *PermissionUpsertOne

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

func (*PermissionUpsertOne) Exec

Exec executes the query.

func (*PermissionUpsertOne) ExecX

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

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

func (*PermissionUpsertOne) ID

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

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

func (*PermissionUpsertOne) IDX

func (u *PermissionUpsertOne) IDX(ctx context.Context) int

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

func (*PermissionUpsertOne) Ignore

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

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

func (*PermissionUpsertOne) SetAction

SetAction sets the "action" field.

func (*PermissionUpsertOne) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*PermissionUpsertOne) SetDeletedAt

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

SetDeletedAt sets the "deleted_at" field.

func (*PermissionUpsertOne) SetRoleID

func (u *PermissionUpsertOne) SetRoleID(v int) *PermissionUpsertOne

SetRoleID sets the "role_id" field.

func (*PermissionUpsertOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*PermissionUpsertOne) SetValue

SetValue sets the "value" field.

func (*PermissionUpsertOne) Update

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

func (*PermissionUpsertOne) UpdateAction

func (u *PermissionUpsertOne) UpdateAction() *PermissionUpsertOne

UpdateAction sets the "action" field to the value that was provided on create.

func (*PermissionUpsertOne) UpdateCreatedAt

func (u *PermissionUpsertOne) UpdateCreatedAt() *PermissionUpsertOne

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

func (*PermissionUpsertOne) UpdateDeletedAt

func (u *PermissionUpsertOne) UpdateDeletedAt() *PermissionUpsertOne

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

func (*PermissionUpsertOne) UpdateNewValues

func (u *PermissionUpsertOne) UpdateNewValues() *PermissionUpsertOne

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

client.Permission.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*PermissionUpsertOne) UpdateRoleID

func (u *PermissionUpsertOne) UpdateRoleID() *PermissionUpsertOne

UpdateRoleID sets the "role_id" field to the value that was provided on create.

func (*PermissionUpsertOne) UpdateUpdatedAt

func (u *PermissionUpsertOne) UpdateUpdatedAt() *PermissionUpsertOne

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

func (*PermissionUpsertOne) UpdateValue

func (u *PermissionUpsertOne) UpdateValue() *PermissionUpsertOne

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

type Permissions

type Permissions []*Permission

Permissions is a parsable slice of Permission.

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 int `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt time.Time `json:"omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Slug holds the value of the "slug" field.
	Slug string `json:"slug,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty" validate:"max=255"`
	// Content holds the value of the "content" field.
	Content string `json:"content,omitempty" validate:"required"`
	// ContentHTML holds the value of the "content_html" field.
	ContentHTML string `json:"content_html,omitempty"`
	// ViewCount holds the value of the "view_count" field.
	ViewCount int64 `json:"view_count,omitempty"`
	// CommentCount holds the value of the "comment_count" field.
	CommentCount int64 `json:"comment_count,omitempty"`
	// RatingCount holds the value of the "rating_count" field.
	RatingCount int64 `json:"rating_count,omitempty"`
	// RatingTotal holds the value of the "rating_total" field.
	RatingTotal int64 `json:"rating_total,omitempty"`
	// Draft holds the value of the "draft" field.
	Draft bool `json:"draft,omitempty"`
	// Approved holds the value of the "approved" field.
	Approved bool `json:"approved,omitempty"`
	// FeaturedImageID holds the value of the "featured_image_id" field.
	FeaturedImageID int `json:"featured_image_id,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID int `json:"user_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) QueryComments

func (po *Post) QueryComments() *CommentQuery

QueryComments queries the "comments" edge of the Post entity.

func (*Post) QueryFeaturedImage

func (po *Post) QueryFeaturedImage() *FileQuery

QueryFeaturedImage queries the "featured_image" edge of the Post entity.

func (*Post) QueryTopics

func (po *Post) QueryTopics() *TopicQuery

QueryTopics queries the "topics" edge of the Post entity.

func (*Post) QueryUser

func (po *Post) QueryUser() *UserQuery

QueryUser queries the "user" 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 create builder for Post.

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 delete builder for the given entity.

func (*PostClient) DeleteOneID

func (c *PostClient) DeleteOneID(id int) *PostDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*PostClient) Get

func (c *PostClient) Get(ctx context.Context, id int) (*Post, error)

Get returns a Post entity by its id.

func (*PostClient) GetX

func (c *PostClient) GetX(ctx context.Context, id int) *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) QueryComments

func (c *PostClient) QueryComments(po *Post) *CommentQuery

QueryComments queries the comments edge of a Post.

func (*PostClient) QueryFeaturedImage

func (c *PostClient) QueryFeaturedImage(po *Post) *FileQuery

QueryFeaturedImage queries the featured_image edge of a Post.

func (*PostClient) QueryTopics

func (c *PostClient) QueryTopics(po *Post) *TopicQuery

QueryTopics queries the topics edge of a Post.

func (*PostClient) QueryUser

func (c *PostClient) QueryUser(po *Post) *UserQuery

QueryUser queries the user 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 int) *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) AddCommentIDs

func (pc *PostCreate) AddCommentIDs(ids ...int) *PostCreate

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*PostCreate) AddComments

func (pc *PostCreate) AddComments(c ...*Comment) *PostCreate

AddComments adds the "comments" edges to the Comment entity.

func (*PostCreate) AddTopicIDs

func (pc *PostCreate) AddTopicIDs(ids ...int) *PostCreate

AddTopicIDs adds the "topics" edge to the Topic entity by IDs.

func (*PostCreate) AddTopics

func (pc *PostCreate) AddTopics(t ...*Topic) *PostCreate

AddTopics adds the "topics" edges to the Topic 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) SetApproved

func (pc *PostCreate) SetApproved(b bool) *PostCreate

SetApproved sets the "approved" field.

func (*PostCreate) SetCommentCount

func (pc *PostCreate) SetCommentCount(i int64) *PostCreate

SetCommentCount sets the "comment_count" field.

func (*PostCreate) SetContent

func (pc *PostCreate) SetContent(s string) *PostCreate

SetContent sets the "content" field.

func (*PostCreate) SetContentHTML

func (pc *PostCreate) SetContentHTML(s string) *PostCreate

SetContentHTML sets the "content_html" 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) SetDescription

func (pc *PostCreate) SetDescription(s string) *PostCreate

SetDescription sets the "description" field.

func (*PostCreate) SetDraft

func (pc *PostCreate) SetDraft(b bool) *PostCreate

SetDraft sets the "draft" field.

func (*PostCreate) SetFeaturedImage

func (pc *PostCreate) SetFeaturedImage(f *File) *PostCreate

SetFeaturedImage sets the "featured_image" edge to the File entity.

func (*PostCreate) SetFeaturedImageID

func (pc *PostCreate) SetFeaturedImageID(i int) *PostCreate

SetFeaturedImageID sets the "featured_image_id" field.

func (*PostCreate) SetName

func (pc *PostCreate) SetName(s string) *PostCreate

SetName sets the "name" field.

func (*PostCreate) SetNillableApproved

func (pc *PostCreate) SetNillableApproved(b *bool) *PostCreate

SetNillableApproved sets the "approved" field if the given value is not nil.

func (*PostCreate) SetNillableCommentCount

func (pc *PostCreate) SetNillableCommentCount(i *int64) *PostCreate

SetNillableCommentCount sets the "comment_count" 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) SetNillableDescription

func (pc *PostCreate) SetNillableDescription(s *string) *PostCreate

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

func (*PostCreate) SetNillableDraft

func (pc *PostCreate) SetNillableDraft(b *bool) *PostCreate

SetNillableDraft sets the "draft" field if the given value is not nil.

func (*PostCreate) SetNillableFeaturedImageID

func (pc *PostCreate) SetNillableFeaturedImageID(i *int) *PostCreate

SetNillableFeaturedImageID sets the "featured_image_id" field if the given value is not nil.

func (*PostCreate) SetNillableRatingCount

func (pc *PostCreate) SetNillableRatingCount(i *int64) *PostCreate

SetNillableRatingCount sets the "rating_count" field if the given value is not nil.

func (*PostCreate) SetNillableRatingTotal

func (pc *PostCreate) SetNillableRatingTotal(i *int64) *PostCreate

SetNillableRatingTotal sets the "rating_total" 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) SetNillableUserID

func (pc *PostCreate) SetNillableUserID(i *int) *PostCreate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*PostCreate) SetNillableViewCount

func (pc *PostCreate) SetNillableViewCount(i *int64) *PostCreate

SetNillableViewCount sets the "view_count" field if the given value is not nil.

func (*PostCreate) SetRatingCount

func (pc *PostCreate) SetRatingCount(i int64) *PostCreate

SetRatingCount sets the "rating_count" field.

func (*PostCreate) SetRatingTotal

func (pc *PostCreate) SetRatingTotal(i int64) *PostCreate

SetRatingTotal sets the "rating_total" field.

func (*PostCreate) SetSlug

func (pc *PostCreate) SetSlug(s string) *PostCreate

SetSlug sets the "slug" field.

func (*PostCreate) SetUpdatedAt

func (pc *PostCreate) SetUpdatedAt(t time.Time) *PostCreate

SetUpdatedAt sets the "updated_at" field.

func (*PostCreate) SetUser

func (pc *PostCreate) SetUser(u *User) *PostCreate

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

func (*PostCreate) SetUserID

func (pc *PostCreate) SetUserID(i int) *PostCreate

SetUserID sets the "user_id" field.

func (*PostCreate) SetViewCount

func (pc *PostCreate) SetViewCount(i int64) *PostCreate

SetViewCount sets the "view_count" 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 {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// Topics holds the value of the topics edge.
	Topics []*Topic `json:"topics,omitempty"`
	// FeaturedImage holds the value of the featured_image edge.
	FeaturedImage *File `json:"featured_image,omitempty"`
	// Comments holds the value of the comments edge.
	Comments []*Comment `json:"comments,omitempty"`
	// contains filtered or unexported fields
}

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

func (PostEdges) CommentsOrErr

func (e PostEdges) CommentsOrErr() ([]*Comment, error)

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

func (PostEdges) FeaturedImageOrErr

func (e PostEdges) FeaturedImageOrErr() (*File, error)

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

func (PostEdges) TopicsOrErr

func (e PostEdges) TopicsOrErr() ([]*Topic, error)

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

func (PostEdges) UserOrErr

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

UserOrErr returns the User value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type PostFilter

type PostFilter struct {
	// contains filtered or unexported fields
}

PostFilter provides a generic filtering capability at runtime for PostQuery.

func (*PostFilter) Where

func (f *PostFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*PostFilter) WhereApproved

func (f *PostFilter) WhereApproved(p entql.BoolP)

WhereApproved applies the entql bool predicate on the approved field.

func (*PostFilter) WhereCommentCount

func (f *PostFilter) WhereCommentCount(p entql.Int64P)

WhereCommentCount applies the entql int64 predicate on the comment_count field.

func (*PostFilter) WhereContent

func (f *PostFilter) WhereContent(p entql.StringP)

WhereContent applies the entql string predicate on the content field.

func (*PostFilter) WhereContentHTML

func (f *PostFilter) WhereContentHTML(p entql.StringP)

WhereContentHTML applies the entql string predicate on the content_html field.

func (*PostFilter) WhereCreatedAt

func (f *PostFilter) WhereCreatedAt(p entql.TimeP)

WhereCreatedAt applies the entql time.Time predicate on the created_at field.

func (*PostFilter) WhereDeletedAt

func (f *PostFilter) WhereDeletedAt(p entql.TimeP)

WhereDeletedAt applies the entql time.Time predicate on the deleted_at field.

func (*PostFilter) WhereDescription

func (f *PostFilter) WhereDescription(p entql.StringP)

WhereDescription applies the entql string predicate on the description field.

func (*PostFilter) WhereDraft

func (f *PostFilter) WhereDraft(p entql.BoolP)

WhereDraft applies the entql bool predicate on the draft field.

func (*PostFilter) WhereFeaturedImageID

func (f *PostFilter) WhereFeaturedImageID(p entql.IntP)

WhereFeaturedImageID applies the entql int predicate on the featured_image_id field.

func (*PostFilter) WhereHasComments

func (f *PostFilter) WhereHasComments()

WhereHasComments applies a predicate to check if query has an edge comments.

func (*PostFilter) WhereHasCommentsWith

func (f *PostFilter) WhereHasCommentsWith(preds ...predicate.Comment)

WhereHasCommentsWith applies a predicate to check if query has an edge comments with a given conditions (other predicates).

func (*PostFilter) WhereHasFeaturedImage

func (f *PostFilter) WhereHasFeaturedImage()

WhereHasFeaturedImage applies a predicate to check if query has an edge featured_image.

func (*PostFilter) WhereHasFeaturedImageWith

func (f *PostFilter) WhereHasFeaturedImageWith(preds ...predicate.File)

WhereHasFeaturedImageWith applies a predicate to check if query has an edge featured_image with a given conditions (other predicates).

func (*PostFilter) WhereHasTopics

func (f *PostFilter) WhereHasTopics()

WhereHasTopics applies a predicate to check if query has an edge topics.

func (*PostFilter) WhereHasTopicsWith

func (f *PostFilter) WhereHasTopicsWith(preds ...predicate.Topic)

WhereHasTopicsWith applies a predicate to check if query has an edge topics with a given conditions (other predicates).

func (*PostFilter) WhereHasUser

func (f *PostFilter) WhereHasUser()

WhereHasUser applies a predicate to check if query has an edge user.

func (*PostFilter) WhereHasUserWith

func (f *PostFilter) WhereHasUserWith(preds ...predicate.User)

WhereHasUserWith applies a predicate to check if query has an edge user with a given conditions (other predicates).

func (*PostFilter) WhereID

func (f *PostFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*PostFilter) WhereName

func (f *PostFilter) WhereName(p entql.StringP)

WhereName applies the entql string predicate on the name field.

func (*PostFilter) WhereRatingCount

func (f *PostFilter) WhereRatingCount(p entql.Int64P)

WhereRatingCount applies the entql int64 predicate on the rating_count field.

func (*PostFilter) WhereRatingTotal

func (f *PostFilter) WhereRatingTotal(p entql.Int64P)

WhereRatingTotal applies the entql int64 predicate on the rating_total field.

func (*PostFilter) WhereSlug

func (f *PostFilter) WhereSlug(p entql.StringP)

WhereSlug applies the entql string predicate on the slug field.

func (*PostFilter) WhereUpdatedAt

func (f *PostFilter) WhereUpdatedAt(p entql.TimeP)

WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.

func (*PostFilter) WhereUserID

func (f *PostFilter) WhereUserID(p entql.IntP)

WhereUserID applies the entql int predicate on the user_id field.

func (*PostFilter) WhereViewCount

func (f *PostFilter) WhereViewCount(p entql.Int64P)

WhereViewCount applies the entql int64 predicate on the view_count field.

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 (pgb *PostGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) BoolX

func (pgb *PostGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*PostGroupBy) Bools

func (pgb *PostGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) BoolsX

func (pgb *PostGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*PostGroupBy) Float64

func (pgb *PostGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) Float64X

func (pgb *PostGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*PostGroupBy) Float64s

func (pgb *PostGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) Float64sX

func (pgb *PostGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*PostGroupBy) Int

func (pgb *PostGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) IntX

func (pgb *PostGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*PostGroupBy) Ints

func (pgb *PostGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) IntsX

func (pgb *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 (pgb *PostGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*PostGroupBy) String

func (pgb *PostGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) StringX

func (pgb *PostGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*PostGroupBy) Strings

func (pgb *PostGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*PostGroupBy) StringsX

func (pgb *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) AddCommentCount

func (m *PostMutation) AddCommentCount(i int64)

AddCommentCount adds i to the "comment_count" field.

func (*PostMutation) AddCommentIDs

func (m *PostMutation) AddCommentIDs(ids ...int)

AddCommentIDs adds the "comments" edge to the Comment entity by ids.

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) AddRatingCount

func (m *PostMutation) AddRatingCount(i int64)

AddRatingCount adds i to the "rating_count" field.

func (*PostMutation) AddRatingTotal

func (m *PostMutation) AddRatingTotal(i int64)

AddRatingTotal adds i to the "rating_total" field.

func (*PostMutation) AddTopicIDs

func (m *PostMutation) AddTopicIDs(ids ...int)

AddTopicIDs adds the "topics" edge to the Topic entity by ids.

func (*PostMutation) AddViewCount

func (m *PostMutation) AddViewCount(i int64)

AddViewCount adds i to the "view_count" field.

func (*PostMutation) AddedCommentCount

func (m *PostMutation) AddedCommentCount() (r int64, exists bool)

AddedCommentCount returns the value that was added to the "comment_count" field in this mutation.

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) AddedRatingCount

func (m *PostMutation) AddedRatingCount() (r int64, exists bool)

AddedRatingCount returns the value that was added to the "rating_count" field in this mutation.

func (*PostMutation) AddedRatingTotal

func (m *PostMutation) AddedRatingTotal() (r int64, exists bool)

AddedRatingTotal returns the value that was added to the "rating_total" field in this mutation.

func (*PostMutation) AddedViewCount

func (m *PostMutation) AddedViewCount() (r int64, exists bool)

AddedViewCount returns the value that was added to the "view_count" field in this mutation.

func (*PostMutation) Approved

func (m *PostMutation) Approved() (r bool, exists bool)

Approved returns the value of the "approved" field in the mutation.

func (*PostMutation) ApprovedCleared

func (m *PostMutation) ApprovedCleared() bool

ApprovedCleared returns if the "approved" field was cleared in this mutation.

func (*PostMutation) ClearApproved

func (m *PostMutation) ClearApproved()

ClearApproved clears the value of the "approved" field.

func (*PostMutation) ClearComments

func (m *PostMutation) ClearComments()

ClearComments clears the "comments" edge to the Comment entity.

func (*PostMutation) ClearDeletedAt

func (m *PostMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PostMutation) ClearDescription

func (m *PostMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*PostMutation) ClearDraft

func (m *PostMutation) ClearDraft()

ClearDraft clears the value of the "draft" 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) ClearFeaturedImage

func (m *PostMutation) ClearFeaturedImage()

ClearFeaturedImage clears the "featured_image" edge to the File entity.

func (*PostMutation) ClearFeaturedImageID

func (m *PostMutation) ClearFeaturedImageID()

ClearFeaturedImageID clears the value of the "featured_image_id" field.

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) ClearRatingCount

func (m *PostMutation) ClearRatingCount()

ClearRatingCount clears the value of the "rating_count" field.

func (*PostMutation) ClearRatingTotal

func (m *PostMutation) ClearRatingTotal()

ClearRatingTotal clears the value of the "rating_total" field.

func (*PostMutation) ClearTopics

func (m *PostMutation) ClearTopics()

ClearTopics clears the "topics" edge to the Topic entity.

func (*PostMutation) ClearUser

func (m *PostMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*PostMutation) ClearUserID

func (m *PostMutation) ClearUserID()

ClearUserID clears the value of the "user_id" 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) CommentCount

func (m *PostMutation) CommentCount() (r int64, exists bool)

CommentCount returns the value of the "comment_count" field in the mutation.

func (*PostMutation) CommentsCleared

func (m *PostMutation) CommentsCleared() bool

CommentsCleared reports if the "comments" edge to the Comment entity was cleared.

func (*PostMutation) CommentsIDs

func (m *PostMutation) CommentsIDs() (ids []int)

CommentsIDs returns the "comments" edge IDs in the mutation.

func (*PostMutation) Content

func (m *PostMutation) Content() (r string, exists bool)

Content returns the value of the "content" field in the mutation.

func (*PostMutation) ContentHTML

func (m *PostMutation) ContentHTML() (r string, exists bool)

ContentHTML returns the value of the "content_html" field in the mutation.

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) Description

func (m *PostMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*PostMutation) DescriptionCleared

func (m *PostMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*PostMutation) Draft

func (m *PostMutation) Draft() (r bool, exists bool)

Draft returns the value of the "draft" field in the mutation.

func (*PostMutation) DraftCleared

func (m *PostMutation) DraftCleared() bool

DraftCleared returns if the "draft" 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) FeaturedImageCleared

func (m *PostMutation) FeaturedImageCleared() bool

FeaturedImageCleared reports if the "featured_image" edge to the File entity was cleared.

func (*PostMutation) FeaturedImageID

func (m *PostMutation) FeaturedImageID() (r int, exists bool)

FeaturedImageID returns the value of the "featured_image_id" field in the mutation.

func (*PostMutation) FeaturedImageIDCleared

func (m *PostMutation) FeaturedImageIDCleared() bool

FeaturedImageIDCleared returns if the "featured_image_id" field was cleared in this mutation.

func (*PostMutation) FeaturedImageIDs

func (m *PostMutation) FeaturedImageIDs() (ids []int)

FeaturedImageIDs returns the "featured_image" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use FeaturedImageID instead. It exists only for internal usage by the builders.

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) Filter

func (m *PostMutation) Filter() *PostFilter

Filter returns an entql.Where implementation to apply filters on the PostMutation builder.

func (*PostMutation) ID

func (m *PostMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*PostMutation) IDs

func (m *PostMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*PostMutation) Name

func (m *PostMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*PostMutation) OldApproved

func (m *PostMutation) OldApproved(ctx context.Context) (v bool, err error)

OldApproved returns the old "approved" 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) OldCommentCount

func (m *PostMutation) OldCommentCount(ctx context.Context) (v int64, err error)

OldCommentCount returns the old "comment_count" 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) OldContent

func (m *PostMutation) OldContent(ctx context.Context) (v string, err error)

OldContent returns the old "content" 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) OldContentHTML

func (m *PostMutation) OldContentHTML(ctx context.Context) (v string, err error)

OldContentHTML returns the old "content_html" 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) OldDescription

func (m *PostMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old "description" 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) OldDraft

func (m *PostMutation) OldDraft(ctx context.Context) (v bool, err error)

OldDraft returns the old "draft" 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) OldFeaturedImageID

func (m *PostMutation) OldFeaturedImageID(ctx context.Context) (v int, err error)

OldFeaturedImageID returns the old "featured_image_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) 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) OldName

func (m *PostMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" 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) OldRatingCount

func (m *PostMutation) OldRatingCount(ctx context.Context) (v int64, err error)

OldRatingCount returns the old "rating_count" 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) OldRatingTotal

func (m *PostMutation) OldRatingTotal(ctx context.Context) (v int64, err error)

OldRatingTotal returns the old "rating_total" 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) 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) OldUserID

func (m *PostMutation) OldUserID(ctx context.Context) (v int, err error)

OldUserID returns the old "user_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) OldViewCount

func (m *PostMutation) OldViewCount(ctx context.Context) (v int64, err error)

OldViewCount returns the old "view_count" 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) RatingCount

func (m *PostMutation) RatingCount() (r int64, exists bool)

RatingCount returns the value of the "rating_count" field in the mutation.

func (*PostMutation) RatingCountCleared

func (m *PostMutation) RatingCountCleared() bool

RatingCountCleared returns if the "rating_count" field was cleared in this mutation.

func (*PostMutation) RatingTotal

func (m *PostMutation) RatingTotal() (r int64, exists bool)

RatingTotal returns the value of the "rating_total" field in the mutation.

func (*PostMutation) RatingTotalCleared

func (m *PostMutation) RatingTotalCleared() bool

RatingTotalCleared returns if the "rating_total" field was cleared in this mutation.

func (*PostMutation) RemoveCommentIDs

func (m *PostMutation) RemoveCommentIDs(ids ...int)

RemoveCommentIDs removes the "comments" edge to the Comment entity by IDs.

func (*PostMutation) RemoveTopicIDs

func (m *PostMutation) RemoveTopicIDs(ids ...int)

RemoveTopicIDs removes the "topics" edge to the Topic entity by IDs.

func (*PostMutation) RemovedCommentsIDs

func (m *PostMutation) RemovedCommentsIDs() (ids []int)

RemovedComments returns the removed IDs of the "comments" edge to the Comment entity.

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) RemovedTopicsIDs

func (m *PostMutation) RemovedTopicsIDs() (ids []int)

RemovedTopics returns the removed IDs of the "topics" edge to the Topic entity.

func (*PostMutation) ResetApproved

func (m *PostMutation) ResetApproved()

ResetApproved resets all changes to the "approved" field.

func (*PostMutation) ResetCommentCount

func (m *PostMutation) ResetCommentCount()

ResetCommentCount resets all changes to the "comment_count" field.

func (*PostMutation) ResetComments

func (m *PostMutation) ResetComments()

ResetComments resets all changes to the "comments" edge.

func (*PostMutation) ResetContent

func (m *PostMutation) ResetContent()

ResetContent resets all changes to the "content" field.

func (*PostMutation) ResetContentHTML

func (m *PostMutation) ResetContentHTML()

ResetContentHTML resets all changes to the "content_html" 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) ResetDescription

func (m *PostMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*PostMutation) ResetDraft

func (m *PostMutation) ResetDraft()

ResetDraft resets all changes to the "draft" 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) ResetFeaturedImage

func (m *PostMutation) ResetFeaturedImage()

ResetFeaturedImage resets all changes to the "featured_image" edge.

func (*PostMutation) ResetFeaturedImageID

func (m *PostMutation) ResetFeaturedImageID()

ResetFeaturedImageID resets all changes to the "featured_image_id" field.

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) ResetName

func (m *PostMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*PostMutation) ResetRatingCount

func (m *PostMutation) ResetRatingCount()

ResetRatingCount resets all changes to the "rating_count" field.

func (*PostMutation) ResetRatingTotal

func (m *PostMutation) ResetRatingTotal()

ResetRatingTotal resets all changes to the "rating_total" field.

func (*PostMutation) ResetSlug

func (m *PostMutation) ResetSlug()

ResetSlug resets all changes to the "slug" field.

func (*PostMutation) ResetTopics

func (m *PostMutation) ResetTopics()

ResetTopics resets all changes to the "topics" edge.

func (*PostMutation) ResetUpdatedAt

func (m *PostMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*PostMutation) ResetUser

func (m *PostMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*PostMutation) ResetUserID

func (m *PostMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*PostMutation) ResetViewCount

func (m *PostMutation) ResetViewCount()

ResetViewCount resets all changes to the "view_count" field.

func (*PostMutation) SetApproved

func (m *PostMutation) SetApproved(b bool)

SetApproved sets the "approved" field.

func (*PostMutation) SetCommentCount

func (m *PostMutation) SetCommentCount(i int64)

SetCommentCount sets the "comment_count" field.

func (*PostMutation) SetContent

func (m *PostMutation) SetContent(s string)

SetContent sets the "content" field.

func (*PostMutation) SetContentHTML

func (m *PostMutation) SetContentHTML(s string)

SetContentHTML sets the "content_html" 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) SetDescription

func (m *PostMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*PostMutation) SetDraft

func (m *PostMutation) SetDraft(b bool)

SetDraft sets the "draft" field.

func (*PostMutation) SetFeaturedImageID

func (m *PostMutation) SetFeaturedImageID(i int)

SetFeaturedImageID sets the "featured_image_id" 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) SetName

func (m *PostMutation) SetName(s string)

SetName sets the "name" field.

func (*PostMutation) SetRatingCount

func (m *PostMutation) SetRatingCount(i int64)

SetRatingCount sets the "rating_count" field.

func (*PostMutation) SetRatingTotal

func (m *PostMutation) SetRatingTotal(i int64)

SetRatingTotal sets the "rating_total" field.

func (*PostMutation) SetSlug

func (m *PostMutation) SetSlug(s string)

SetSlug sets the "slug" field.

func (*PostMutation) SetUpdatedAt

func (m *PostMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*PostMutation) SetUserID

func (m *PostMutation) SetUserID(i int)

SetUserID sets the "user_id" field.

func (*PostMutation) SetViewCount

func (m *PostMutation) SetViewCount(i int64)

SetViewCount sets the "view_count" field.

func (*PostMutation) Slug

func (m *PostMutation) Slug() (r string, exists bool)

Slug returns the value of the "slug" field in the mutation.

func (*PostMutation) TopicsCleared

func (m *PostMutation) TopicsCleared() bool

TopicsCleared reports if the "topics" edge to the Topic entity was cleared.

func (*PostMutation) TopicsIDs

func (m *PostMutation) TopicsIDs() (ids []int)

TopicsIDs returns the "topics" edge IDs in the 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) UserCleared

func (m *PostMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*PostMutation) UserID

func (m *PostMutation) UserID() (r int, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*PostMutation) UserIDCleared

func (m *PostMutation) UserIDCleared() bool

UserIDCleared returns if the "user_id" field was cleared in this mutation.

func (*PostMutation) UserIDs

func (m *PostMutation) UserIDs() (ids []int)

UserIDs returns the "user" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use UserID instead. It exists only for internal usage by the builders.

func (*PostMutation) ViewCount

func (m *PostMutation) ViewCount() (r int64, exists bool)

ViewCount returns the value of the "view_count" 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) Filter

func (pq *PostQuery) Filter() *PostFilter

Filter returns a Filter implementation to apply filters on the PostQuery builder.

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 int, 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) int

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:"omitempty"`
	Count int `json:"count,omitempty"`
}

client.Post.Query().
	GroupBy(post.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*PostQuery) IDs

func (pq *PostQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Post IDs.

func (*PostQuery) IDsX

func (pq *PostQuery) IDsX(ctx context.Context) []int

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) 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 int, 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) int

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) QueryComments

func (pq *PostQuery) QueryComments() *CommentQuery

QueryComments chains the current query on the "comments" edge.

func (*PostQuery) QueryFeaturedImage

func (pq *PostQuery) QueryFeaturedImage() *FileQuery

QueryFeaturedImage chains the current query on the "featured_image" edge.

func (*PostQuery) QueryTopics

func (pq *PostQuery) QueryTopics() *TopicQuery

QueryTopics chains the current query on the "topics" edge.

func (*PostQuery) QueryUser

func (pq *PostQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" 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:"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) WithComments

func (pq *PostQuery) WithComments(opts ...func(*CommentQuery)) *PostQuery

WithComments tells the query-builder to eager-load the nodes that are connected to the "comments" edge. The optional arguments are used to configure the query builder of the edge.

func (*PostQuery) WithFeaturedImage

func (pq *PostQuery) WithFeaturedImage(opts ...func(*FileQuery)) *PostQuery

WithFeaturedImage tells the query-builder to eager-load the nodes that are connected to the "featured_image" edge. The optional arguments are used to configure the query builder of the edge.

func (*PostQuery) WithTopics

func (pq *PostQuery) WithTopics(opts ...func(*TopicQuery)) *PostQuery

WithTopics tells the query-builder to eager-load the nodes that are connected to the "topics" edge. The optional arguments are used to configure the query builder of the edge.

func (*PostQuery) WithUser

func (pq *PostQuery) WithUser(opts ...func(*UserQuery)) *PostQuery

WithUser tells the query-builder to eager-load the nodes that are connected to the "user" edge. The optional arguments are used to configure the query builder of the edge.

type PostSelect

type PostSelect struct {
	*PostQuery
	// contains filtered or unexported fields
}

PostSelect is the builder for selecting fields of Post entities.

func (*PostSelect) Bool

func (ps *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 (ps *PostSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*PostSelect) Bools

func (ps *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 (ps *PostSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*PostSelect) Float64

func (ps *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 (ps *PostSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*PostSelect) Float64s

func (ps *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 (ps *PostSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*PostSelect) Int

func (ps *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 (ps *PostSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*PostSelect) Ints

func (ps *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 (ps *PostSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

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 (ps *PostSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*PostSelect) String

func (ps *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 (ps *PostSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*PostSelect) Strings

func (ps *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 (ps *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) AddCommentCount

func (pu *PostUpdate) AddCommentCount(i int64) *PostUpdate

AddCommentCount adds i to the "comment_count" field.

func (*PostUpdate) AddCommentIDs

func (pu *PostUpdate) AddCommentIDs(ids ...int) *PostUpdate

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*PostUpdate) AddComments

func (pu *PostUpdate) AddComments(c ...*Comment) *PostUpdate

AddComments adds the "comments" edges to the Comment entity.

func (*PostUpdate) AddRatingCount

func (pu *PostUpdate) AddRatingCount(i int64) *PostUpdate

AddRatingCount adds i to the "rating_count" field.

func (*PostUpdate) AddRatingTotal

func (pu *PostUpdate) AddRatingTotal(i int64) *PostUpdate

AddRatingTotal adds i to the "rating_total" field.

func (*PostUpdate) AddTopicIDs

func (pu *PostUpdate) AddTopicIDs(ids ...int) *PostUpdate

AddTopicIDs adds the "topics" edge to the Topic entity by IDs.

func (*PostUpdate) AddTopics

func (pu *PostUpdate) AddTopics(t ...*Topic) *PostUpdate

AddTopics adds the "topics" edges to the Topic entity.

func (*PostUpdate) AddViewCount

func (pu *PostUpdate) AddViewCount(i int64) *PostUpdate

AddViewCount adds i to the "view_count" field.

func (*PostUpdate) ClearApproved

func (pu *PostUpdate) ClearApproved() *PostUpdate

ClearApproved clears the value of the "approved" field.

func (*PostUpdate) ClearComments

func (pu *PostUpdate) ClearComments() *PostUpdate

ClearComments clears all "comments" edges to the Comment entity.

func (*PostUpdate) ClearDeletedAt

func (pu *PostUpdate) ClearDeletedAt() *PostUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PostUpdate) ClearDescription

func (pu *PostUpdate) ClearDescription() *PostUpdate

ClearDescription clears the value of the "description" field.

func (*PostUpdate) ClearDraft

func (pu *PostUpdate) ClearDraft() *PostUpdate

ClearDraft clears the value of the "draft" field.

func (*PostUpdate) ClearFeaturedImage

func (pu *PostUpdate) ClearFeaturedImage() *PostUpdate

ClearFeaturedImage clears the "featured_image" edge to the File entity.

func (*PostUpdate) ClearFeaturedImageID

func (pu *PostUpdate) ClearFeaturedImageID() *PostUpdate

ClearFeaturedImageID clears the value of the "featured_image_id" field.

func (*PostUpdate) ClearRatingCount

func (pu *PostUpdate) ClearRatingCount() *PostUpdate

ClearRatingCount clears the value of the "rating_count" field.

func (*PostUpdate) ClearRatingTotal

func (pu *PostUpdate) ClearRatingTotal() *PostUpdate

ClearRatingTotal clears the value of the "rating_total" field.

func (*PostUpdate) ClearTopics

func (pu *PostUpdate) ClearTopics() *PostUpdate

ClearTopics clears all "topics" edges to the Topic entity.

func (*PostUpdate) ClearUser

func (pu *PostUpdate) ClearUser() *PostUpdate

ClearUser clears the "user" edge to the User entity.

func (*PostUpdate) ClearUserID

func (pu *PostUpdate) ClearUserID() *PostUpdate

ClearUserID clears the value of the "user_id" 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) Mutation

func (pu *PostUpdate) Mutation() *PostMutation

Mutation returns the PostMutation object of the builder.

func (*PostUpdate) RemoveCommentIDs

func (pu *PostUpdate) RemoveCommentIDs(ids ...int) *PostUpdate

RemoveCommentIDs removes the "comments" edge to Comment entities by IDs.

func (*PostUpdate) RemoveComments

func (pu *PostUpdate) RemoveComments(c ...*Comment) *PostUpdate

RemoveComments removes "comments" edges to Comment entities.

func (*PostUpdate) RemoveTopicIDs

func (pu *PostUpdate) RemoveTopicIDs(ids ...int) *PostUpdate

RemoveTopicIDs removes the "topics" edge to Topic entities by IDs.

func (*PostUpdate) RemoveTopics

func (pu *PostUpdate) RemoveTopics(t ...*Topic) *PostUpdate

RemoveTopics removes "topics" edges to Topic 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) SetApproved

func (pu *PostUpdate) SetApproved(b bool) *PostUpdate

SetApproved sets the "approved" field.

func (*PostUpdate) SetCommentCount

func (pu *PostUpdate) SetCommentCount(i int64) *PostUpdate

SetCommentCount sets the "comment_count" field.

func (*PostUpdate) SetContent

func (pu *PostUpdate) SetContent(s string) *PostUpdate

SetContent sets the "content" field.

func (*PostUpdate) SetContentHTML

func (pu *PostUpdate) SetContentHTML(s string) *PostUpdate

SetContentHTML sets the "content_html" field.

func (*PostUpdate) SetDeletedAt

func (pu *PostUpdate) SetDeletedAt(t time.Time) *PostUpdate

SetDeletedAt sets the "deleted_at" field.

func (*PostUpdate) SetDescription

func (pu *PostUpdate) SetDescription(s string) *PostUpdate

SetDescription sets the "description" field.

func (*PostUpdate) SetDraft

func (pu *PostUpdate) SetDraft(b bool) *PostUpdate

SetDraft sets the "draft" field.

func (*PostUpdate) SetFeaturedImage

func (pu *PostUpdate) SetFeaturedImage(f *File) *PostUpdate

SetFeaturedImage sets the "featured_image" edge to the File entity.

func (*PostUpdate) SetFeaturedImageID

func (pu *PostUpdate) SetFeaturedImageID(i int) *PostUpdate

SetFeaturedImageID sets the "featured_image_id" field.

func (*PostUpdate) SetName

func (pu *PostUpdate) SetName(s string) *PostUpdate

SetName sets the "name" field.

func (*PostUpdate) SetNillableApproved

func (pu *PostUpdate) SetNillableApproved(b *bool) *PostUpdate

SetNillableApproved sets the "approved" field if the given value is not nil.

func (*PostUpdate) SetNillableCommentCount

func (pu *PostUpdate) SetNillableCommentCount(i *int64) *PostUpdate

SetNillableCommentCount sets the "comment_count" 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) SetNillableDescription

func (pu *PostUpdate) SetNillableDescription(s *string) *PostUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PostUpdate) SetNillableDraft

func (pu *PostUpdate) SetNillableDraft(b *bool) *PostUpdate

SetNillableDraft sets the "draft" field if the given value is not nil.

func (*PostUpdate) SetNillableFeaturedImageID

func (pu *PostUpdate) SetNillableFeaturedImageID(i *int) *PostUpdate

SetNillableFeaturedImageID sets the "featured_image_id" field if the given value is not nil.

func (*PostUpdate) SetNillableRatingCount

func (pu *PostUpdate) SetNillableRatingCount(i *int64) *PostUpdate

SetNillableRatingCount sets the "rating_count" field if the given value is not nil.

func (*PostUpdate) SetNillableRatingTotal

func (pu *PostUpdate) SetNillableRatingTotal(i *int64) *PostUpdate

SetNillableRatingTotal sets the "rating_total" field if the given value is not nil.

func (*PostUpdate) SetNillableUserID

func (pu *PostUpdate) SetNillableUserID(i *int) *PostUpdate

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*PostUpdate) SetNillableViewCount

func (pu *PostUpdate) SetNillableViewCount(i *int64) *PostUpdate

SetNillableViewCount sets the "view_count" field if the given value is not nil.

func (*PostUpdate) SetRatingCount

func (pu *PostUpdate) SetRatingCount(i int64) *PostUpdate

SetRatingCount sets the "rating_count" field.

func (*PostUpdate) SetRatingTotal

func (pu *PostUpdate) SetRatingTotal(i int64) *PostUpdate

SetRatingTotal sets the "rating_total" field.

func (*PostUpdate) SetSlug

func (pu *PostUpdate) SetSlug(s string) *PostUpdate

SetSlug sets the "slug" field.

func (*PostUpdate) SetUpdatedAt

func (pu *PostUpdate) SetUpdatedAt(t time.Time) *PostUpdate

SetUpdatedAt sets the "updated_at" field.

func (*PostUpdate) SetUser

func (pu *PostUpdate) SetUser(u *User) *PostUpdate

SetUser sets the "user" edge to the User entity.

func (*PostUpdate) SetUserID

func (pu *PostUpdate) SetUserID(i int) *PostUpdate

SetUserID sets the "user_id" field.

func (*PostUpdate) SetViewCount

func (pu *PostUpdate) SetViewCount(i int64) *PostUpdate

SetViewCount sets the "view_count" 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) AddCommentCount

func (puo *PostUpdateOne) AddCommentCount(i int64) *PostUpdateOne

AddCommentCount adds i to the "comment_count" field.

func (*PostUpdateOne) AddCommentIDs

func (puo *PostUpdateOne) AddCommentIDs(ids ...int) *PostUpdateOne

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*PostUpdateOne) AddComments

func (puo *PostUpdateOne) AddComments(c ...*Comment) *PostUpdateOne

AddComments adds the "comments" edges to the Comment entity.

func (*PostUpdateOne) AddRatingCount

func (puo *PostUpdateOne) AddRatingCount(i int64) *PostUpdateOne

AddRatingCount adds i to the "rating_count" field.

func (*PostUpdateOne) AddRatingTotal

func (puo *PostUpdateOne) AddRatingTotal(i int64) *PostUpdateOne

AddRatingTotal adds i to the "rating_total" field.

func (*PostUpdateOne) AddTopicIDs

func (puo *PostUpdateOne) AddTopicIDs(ids ...int) *PostUpdateOne

AddTopicIDs adds the "topics" edge to the Topic entity by IDs.

func (*PostUpdateOne) AddTopics

func (puo *PostUpdateOne) AddTopics(t ...*Topic) *PostUpdateOne

AddTopics adds the "topics" edges to the Topic entity.

func (*PostUpdateOne) AddViewCount

func (puo *PostUpdateOne) AddViewCount(i int64) *PostUpdateOne

AddViewCount adds i to the "view_count" field.

func (*PostUpdateOne) ClearApproved

func (puo *PostUpdateOne) ClearApproved() *PostUpdateOne

ClearApproved clears the value of the "approved" field.

func (*PostUpdateOne) ClearComments

func (puo *PostUpdateOne) ClearComments() *PostUpdateOne

ClearComments clears all "comments" edges to the Comment entity.

func (*PostUpdateOne) ClearDeletedAt

func (puo *PostUpdateOne) ClearDeletedAt() *PostUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PostUpdateOne) ClearDescription

func (puo *PostUpdateOne) ClearDescription() *PostUpdateOne

ClearDescription clears the value of the "description" field.

func (*PostUpdateOne) ClearDraft

func (puo *PostUpdateOne) ClearDraft() *PostUpdateOne

ClearDraft clears the value of the "draft" field.

func (*PostUpdateOne) ClearFeaturedImage

func (puo *PostUpdateOne) ClearFeaturedImage() *PostUpdateOne

ClearFeaturedImage clears the "featured_image" edge to the File entity.

func (*PostUpdateOne) ClearFeaturedImageID

func (puo *PostUpdateOne) ClearFeaturedImageID() *PostUpdateOne

ClearFeaturedImageID clears the value of the "featured_image_id" field.

func (*PostUpdateOne) ClearRatingCount

func (puo *PostUpdateOne) ClearRatingCount() *PostUpdateOne

ClearRatingCount clears the value of the "rating_count" field.

func (*PostUpdateOne) ClearRatingTotal

func (puo *PostUpdateOne) ClearRatingTotal() *PostUpdateOne

ClearRatingTotal clears the value of the "rating_total" field.

func (*PostUpdateOne) ClearTopics

func (puo *PostUpdateOne) ClearTopics() *PostUpdateOne

ClearTopics clears all "topics" edges to the Topic entity.

func (*PostUpdateOne) ClearUser

func (puo *PostUpdateOne) ClearUser() *PostUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*PostUpdateOne) ClearUserID

func (puo *PostUpdateOne) ClearUserID() *PostUpdateOne

ClearUserID clears the value of the "user_id" 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) Mutation

func (puo *PostUpdateOne) Mutation() *PostMutation

Mutation returns the PostMutation object of the builder.

func (*PostUpdateOne) RemoveCommentIDs

func (puo *PostUpdateOne) RemoveCommentIDs(ids ...int) *PostUpdateOne

RemoveCommentIDs removes the "comments" edge to Comment entities by IDs.

func (*PostUpdateOne) RemoveComments

func (puo *PostUpdateOne) RemoveComments(c ...*Comment) *PostUpdateOne

RemoveComments removes "comments" edges to Comment entities.

func (*PostUpdateOne) RemoveTopicIDs

func (puo *PostUpdateOne) RemoveTopicIDs(ids ...int) *PostUpdateOne

RemoveTopicIDs removes the "topics" edge to Topic entities by IDs.

func (*PostUpdateOne) RemoveTopics

func (puo *PostUpdateOne) RemoveTopics(t ...*Topic) *PostUpdateOne

RemoveTopics removes "topics" edges to Topic 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) SetApproved

func (puo *PostUpdateOne) SetApproved(b bool) *PostUpdateOne

SetApproved sets the "approved" field.

func (*PostUpdateOne) SetCommentCount

func (puo *PostUpdateOne) SetCommentCount(i int64) *PostUpdateOne

SetCommentCount sets the "comment_count" field.

func (*PostUpdateOne) SetContent

func (puo *PostUpdateOne) SetContent(s string) *PostUpdateOne

SetContent sets the "content" field.

func (*PostUpdateOne) SetContentHTML

func (puo *PostUpdateOne) SetContentHTML(s string) *PostUpdateOne

SetContentHTML sets the "content_html" field.

func (*PostUpdateOne) SetDeletedAt

func (puo *PostUpdateOne) SetDeletedAt(t time.Time) *PostUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*PostUpdateOne) SetDescription

func (puo *PostUpdateOne) SetDescription(s string) *PostUpdateOne

SetDescription sets the "description" field.

func (*PostUpdateOne) SetDraft

func (puo *PostUpdateOne) SetDraft(b bool) *PostUpdateOne

SetDraft sets the "draft" field.

func (*PostUpdateOne) SetFeaturedImage

func (puo *PostUpdateOne) SetFeaturedImage(f *File) *PostUpdateOne

SetFeaturedImage sets the "featured_image" edge to the File entity.

func (*PostUpdateOne) SetFeaturedImageID

func (puo *PostUpdateOne) SetFeaturedImageID(i int) *PostUpdateOne

SetFeaturedImageID sets the "featured_image_id" field.

func (*PostUpdateOne) SetName

func (puo *PostUpdateOne) SetName(s string) *PostUpdateOne

SetName sets the "name" field.

func (*PostUpdateOne) SetNillableApproved

func (puo *PostUpdateOne) SetNillableApproved(b *bool) *PostUpdateOne

SetNillableApproved sets the "approved" field if the given value is not nil.

func (*PostUpdateOne) SetNillableCommentCount

func (puo *PostUpdateOne) SetNillableCommentCount(i *int64) *PostUpdateOne

SetNillableCommentCount sets the "comment_count" 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) SetNillableDescription

func (puo *PostUpdateOne) SetNillableDescription(s *string) *PostUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*PostUpdateOne) SetNillableDraft

func (puo *PostUpdateOne) SetNillableDraft(b *bool) *PostUpdateOne

SetNillableDraft sets the "draft" field if the given value is not nil.

func (*PostUpdateOne) SetNillableFeaturedImageID

func (puo *PostUpdateOne) SetNillableFeaturedImageID(i *int) *PostUpdateOne

SetNillableFeaturedImageID sets the "featured_image_id" field if the given value is not nil.

func (*PostUpdateOne) SetNillableRatingCount

func (puo *PostUpdateOne) SetNillableRatingCount(i *int64) *PostUpdateOne

SetNillableRatingCount sets the "rating_count" field if the given value is not nil.

func (*PostUpdateOne) SetNillableRatingTotal

func (puo *PostUpdateOne) SetNillableRatingTotal(i *int64) *PostUpdateOne

SetNillableRatingTotal sets the "rating_total" field if the given value is not nil.

func (*PostUpdateOne) SetNillableUserID

func (puo *PostUpdateOne) SetNillableUserID(i *int) *PostUpdateOne

SetNillableUserID sets the "user_id" field if the given value is not nil.

func (*PostUpdateOne) SetNillableViewCount

func (puo *PostUpdateOne) SetNillableViewCount(i *int64) *PostUpdateOne

SetNillableViewCount sets the "view_count" field if the given value is not nil.

func (*PostUpdateOne) SetRatingCount

func (puo *PostUpdateOne) SetRatingCount(i int64) *PostUpdateOne

SetRatingCount sets the "rating_count" field.

func (*PostUpdateOne) SetRatingTotal

func (puo *PostUpdateOne) SetRatingTotal(i int64) *PostUpdateOne

SetRatingTotal sets the "rating_total" field.

func (*PostUpdateOne) SetSlug

func (puo *PostUpdateOne) SetSlug(s string) *PostUpdateOne

SetSlug sets the "slug" field.

func (*PostUpdateOne) SetUpdatedAt

func (puo *PostUpdateOne) SetUpdatedAt(t time.Time) *PostUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*PostUpdateOne) SetUser

func (puo *PostUpdateOne) SetUser(u *User) *PostUpdateOne

SetUser sets the "user" edge to the User entity.

func (*PostUpdateOne) SetUserID

func (puo *PostUpdateOne) SetUserID(i int) *PostUpdateOne

SetUserID sets the "user_id" field.

func (*PostUpdateOne) SetViewCount

func (puo *PostUpdateOne) SetViewCount(i int64) *PostUpdateOne

SetViewCount sets the "view_count" field.

type PostUpsert

type PostUpsert struct {
	*sql.UpdateSet
}

PostUpsert is the "OnConflict" setter.

func (*PostUpsert) AddCommentCount

func (u *PostUpsert) AddCommentCount(v int64) *PostUpsert

AddCommentCount adds v to the "comment_count" field.

func (*PostUpsert) AddRatingCount

func (u *PostUpsert) AddRatingCount(v int64) *PostUpsert

AddRatingCount adds v to the "rating_count" field.

func (*PostUpsert) AddRatingTotal

func (u *PostUpsert) AddRatingTotal(v int64) *PostUpsert

AddRatingTotal adds v to the "rating_total" field.

func (*PostUpsert) AddViewCount

func (u *PostUpsert) AddViewCount(v int64) *PostUpsert

AddViewCount adds v to the "view_count" field.

func (*PostUpsert) ClearApproved

func (u *PostUpsert) ClearApproved() *PostUpsert

ClearApproved clears the value of the "approved" field.

func (*PostUpsert) ClearDeletedAt

func (u *PostUpsert) ClearDeletedAt() *PostUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PostUpsert) ClearDescription

func (u *PostUpsert) ClearDescription() *PostUpsert

ClearDescription clears the value of the "description" field.

func (*PostUpsert) ClearDraft

func (u *PostUpsert) ClearDraft() *PostUpsert

ClearDraft clears the value of the "draft" field.

func (*PostUpsert) ClearFeaturedImageID

func (u *PostUpsert) ClearFeaturedImageID() *PostUpsert

ClearFeaturedImageID clears the value of the "featured_image_id" field.

func (*PostUpsert) ClearRatingCount

func (u *PostUpsert) ClearRatingCount() *PostUpsert

ClearRatingCount clears the value of the "rating_count" field.

func (*PostUpsert) ClearRatingTotal

func (u *PostUpsert) ClearRatingTotal() *PostUpsert

ClearRatingTotal clears the value of the "rating_total" field.

func (*PostUpsert) ClearUserID

func (u *PostUpsert) ClearUserID() *PostUpsert

ClearUserID clears the value of the "user_id" field.

func (*PostUpsert) SetApproved

func (u *PostUpsert) SetApproved(v bool) *PostUpsert

SetApproved sets the "approved" field.

func (*PostUpsert) SetCommentCount

func (u *PostUpsert) SetCommentCount(v int64) *PostUpsert

SetCommentCount sets the "comment_count" field.

func (*PostUpsert) SetContent

func (u *PostUpsert) SetContent(v string) *PostUpsert

SetContent sets the "content" field.

func (*PostUpsert) SetContentHTML

func (u *PostUpsert) SetContentHTML(v string) *PostUpsert

SetContentHTML sets the "content_html" 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) SetDescription

func (u *PostUpsert) SetDescription(v string) *PostUpsert

SetDescription sets the "description" field.

func (*PostUpsert) SetDraft

func (u *PostUpsert) SetDraft(v bool) *PostUpsert

SetDraft sets the "draft" field.

func (*PostUpsert) SetFeaturedImageID

func (u *PostUpsert) SetFeaturedImageID(v int) *PostUpsert

SetFeaturedImageID sets the "featured_image_id" field.

func (*PostUpsert) SetName

func (u *PostUpsert) SetName(v string) *PostUpsert

SetName sets the "name" field.

func (*PostUpsert) SetRatingCount

func (u *PostUpsert) SetRatingCount(v int64) *PostUpsert

SetRatingCount sets the "rating_count" field.

func (*PostUpsert) SetRatingTotal

func (u *PostUpsert) SetRatingTotal(v int64) *PostUpsert

SetRatingTotal sets the "rating_total" field.

func (*PostUpsert) SetSlug

func (u *PostUpsert) SetSlug(v string) *PostUpsert

SetSlug sets the "slug" field.

func (*PostUpsert) SetUpdatedAt

func (u *PostUpsert) SetUpdatedAt(v time.Time) *PostUpsert

SetUpdatedAt sets the "updated_at" field.

func (*PostUpsert) SetUserID

func (u *PostUpsert) SetUserID(v int) *PostUpsert

SetUserID sets the "user_id" field.

func (*PostUpsert) SetViewCount

func (u *PostUpsert) SetViewCount(v int64) *PostUpsert

SetViewCount sets the "view_count" field.

func (*PostUpsert) UpdateApproved

func (u *PostUpsert) UpdateApproved() *PostUpsert

UpdateApproved sets the "approved" field to the value that was provided on create.

func (*PostUpsert) UpdateCommentCount

func (u *PostUpsert) UpdateCommentCount() *PostUpsert

UpdateCommentCount sets the "comment_count" field to the value that was provided on create.

func (*PostUpsert) UpdateContent

func (u *PostUpsert) UpdateContent() *PostUpsert

UpdateContent sets the "content" field to the value that was provided on create.

func (*PostUpsert) UpdateContentHTML

func (u *PostUpsert) UpdateContentHTML() *PostUpsert

UpdateContentHTML sets the "content_html" 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) UpdateDescription

func (u *PostUpsert) UpdateDescription() *PostUpsert

UpdateDescription sets the "description" field to the value that was provided on create.

func (*PostUpsert) UpdateDraft

func (u *PostUpsert) UpdateDraft() *PostUpsert

UpdateDraft sets the "draft" field to the value that was provided on create.

func (*PostUpsert) UpdateFeaturedImageID

func (u *PostUpsert) UpdateFeaturedImageID() *PostUpsert

UpdateFeaturedImageID sets the "featured_image_id" field to the value that was provided on create.

func (*PostUpsert) UpdateName

func (u *PostUpsert) UpdateName() *PostUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*PostUpsert) UpdateRatingCount

func (u *PostUpsert) UpdateRatingCount() *PostUpsert

UpdateRatingCount sets the "rating_count" field to the value that was provided on create.

func (*PostUpsert) UpdateRatingTotal

func (u *PostUpsert) UpdateRatingTotal() *PostUpsert

UpdateRatingTotal sets the "rating_total" 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) UpdateUpdatedAt

func (u *PostUpsert) UpdateUpdatedAt() *PostUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*PostUpsert) UpdateUserID

func (u *PostUpsert) UpdateUserID() *PostUpsert

UpdateUserID sets the "user_id" field to the value that was provided on create.

func (*PostUpsert) UpdateViewCount

func (u *PostUpsert) UpdateViewCount() *PostUpsert

UpdateViewCount sets the "view_count" 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) AddCommentCount

func (u *PostUpsertBulk) AddCommentCount(v int64) *PostUpsertBulk

AddCommentCount adds v to the "comment_count" field.

func (*PostUpsertBulk) AddRatingCount

func (u *PostUpsertBulk) AddRatingCount(v int64) *PostUpsertBulk

AddRatingCount adds v to the "rating_count" field.

func (*PostUpsertBulk) AddRatingTotal

func (u *PostUpsertBulk) AddRatingTotal(v int64) *PostUpsertBulk

AddRatingTotal adds v to the "rating_total" field.

func (*PostUpsertBulk) AddViewCount

func (u *PostUpsertBulk) AddViewCount(v int64) *PostUpsertBulk

AddViewCount adds v to the "view_count" field.

func (*PostUpsertBulk) ClearApproved

func (u *PostUpsertBulk) ClearApproved() *PostUpsertBulk

ClearApproved clears the value of the "approved" field.

func (*PostUpsertBulk) ClearDeletedAt

func (u *PostUpsertBulk) ClearDeletedAt() *PostUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PostUpsertBulk) ClearDescription

func (u *PostUpsertBulk) ClearDescription() *PostUpsertBulk

ClearDescription clears the value of the "description" field.

func (*PostUpsertBulk) ClearDraft

func (u *PostUpsertBulk) ClearDraft() *PostUpsertBulk

ClearDraft clears the value of the "draft" field.

func (*PostUpsertBulk) ClearFeaturedImageID

func (u *PostUpsertBulk) ClearFeaturedImageID() *PostUpsertBulk

ClearFeaturedImageID clears the value of the "featured_image_id" field.

func (*PostUpsertBulk) ClearRatingCount

func (u *PostUpsertBulk) ClearRatingCount() *PostUpsertBulk

ClearRatingCount clears the value of the "rating_count" field.

func (*PostUpsertBulk) ClearRatingTotal

func (u *PostUpsertBulk) ClearRatingTotal() *PostUpsertBulk

ClearRatingTotal clears the value of the "rating_total" field.

func (*PostUpsertBulk) ClearUserID

func (u *PostUpsertBulk) ClearUserID() *PostUpsertBulk

ClearUserID clears the value of the "user_id" 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) SetApproved

func (u *PostUpsertBulk) SetApproved(v bool) *PostUpsertBulk

SetApproved sets the "approved" field.

func (*PostUpsertBulk) SetCommentCount

func (u *PostUpsertBulk) SetCommentCount(v int64) *PostUpsertBulk

SetCommentCount sets the "comment_count" field.

func (*PostUpsertBulk) SetContent

func (u *PostUpsertBulk) SetContent(v string) *PostUpsertBulk

SetContent sets the "content" field.

func (*PostUpsertBulk) SetContentHTML

func (u *PostUpsertBulk) SetContentHTML(v string) *PostUpsertBulk

SetContentHTML sets the "content_html" 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) SetDescription

func (u *PostUpsertBulk) SetDescription(v string) *PostUpsertBulk

SetDescription sets the "description" field.

func (*PostUpsertBulk) SetDraft

func (u *PostUpsertBulk) SetDraft(v bool) *PostUpsertBulk

SetDraft sets the "draft" field.

func (*PostUpsertBulk) SetFeaturedImageID

func (u *PostUpsertBulk) SetFeaturedImageID(v int) *PostUpsertBulk

SetFeaturedImageID sets the "featured_image_id" field.

func (*PostUpsertBulk) SetName

func (u *PostUpsertBulk) SetName(v string) *PostUpsertBulk

SetName sets the "name" field.

func (*PostUpsertBulk) SetRatingCount

func (u *PostUpsertBulk) SetRatingCount(v int64) *PostUpsertBulk

SetRatingCount sets the "rating_count" field.

func (*PostUpsertBulk) SetRatingTotal

func (u *PostUpsertBulk) SetRatingTotal(v int64) *PostUpsertBulk

SetRatingTotal sets the "rating_total" field.

func (*PostUpsertBulk) SetSlug

func (u *PostUpsertBulk) SetSlug(v string) *PostUpsertBulk

SetSlug sets the "slug" field.

func (*PostUpsertBulk) SetUpdatedAt

func (u *PostUpsertBulk) SetUpdatedAt(v time.Time) *PostUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*PostUpsertBulk) SetUserID

func (u *PostUpsertBulk) SetUserID(v int) *PostUpsertBulk

SetUserID sets the "user_id" field.

func (*PostUpsertBulk) SetViewCount

func (u *PostUpsertBulk) SetViewCount(v int64) *PostUpsertBulk

SetViewCount sets the "view_count" 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) UpdateApproved

func (u *PostUpsertBulk) UpdateApproved() *PostUpsertBulk

UpdateApproved sets the "approved" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateCommentCount

func (u *PostUpsertBulk) UpdateCommentCount() *PostUpsertBulk

UpdateCommentCount sets the "comment_count" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateContent

func (u *PostUpsertBulk) UpdateContent() *PostUpsertBulk

UpdateContent sets the "content" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateContentHTML

func (u *PostUpsertBulk) UpdateContentHTML() *PostUpsertBulk

UpdateContentHTML sets the "content_html" 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) UpdateDescription

func (u *PostUpsertBulk) UpdateDescription() *PostUpsertBulk

UpdateDescription sets the "description" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateDraft

func (u *PostUpsertBulk) UpdateDraft() *PostUpsertBulk

UpdateDraft sets the "draft" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateFeaturedImageID

func (u *PostUpsertBulk) UpdateFeaturedImageID() *PostUpsertBulk

UpdateFeaturedImageID sets the "featured_image_id" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateName

func (u *PostUpsertBulk) UpdateName() *PostUpsertBulk

UpdateName sets the "name" 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(),
	).
	Exec(ctx)

func (*PostUpsertBulk) UpdateRatingCount

func (u *PostUpsertBulk) UpdateRatingCount() *PostUpsertBulk

UpdateRatingCount sets the "rating_count" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateRatingTotal

func (u *PostUpsertBulk) UpdateRatingTotal() *PostUpsertBulk

UpdateRatingTotal sets the "rating_total" 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) UpdateUpdatedAt

func (u *PostUpsertBulk) UpdateUpdatedAt() *PostUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateUserID

func (u *PostUpsertBulk) UpdateUserID() *PostUpsertBulk

UpdateUserID sets the "user_id" field to the value that was provided on create.

func (*PostUpsertBulk) UpdateViewCount

func (u *PostUpsertBulk) UpdateViewCount() *PostUpsertBulk

UpdateViewCount sets the "view_count" 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) AddCommentCount

func (u *PostUpsertOne) AddCommentCount(v int64) *PostUpsertOne

AddCommentCount adds v to the "comment_count" field.

func (*PostUpsertOne) AddRatingCount

func (u *PostUpsertOne) AddRatingCount(v int64) *PostUpsertOne

AddRatingCount adds v to the "rating_count" field.

func (*PostUpsertOne) AddRatingTotal

func (u *PostUpsertOne) AddRatingTotal(v int64) *PostUpsertOne

AddRatingTotal adds v to the "rating_total" field.

func (*PostUpsertOne) AddViewCount

func (u *PostUpsertOne) AddViewCount(v int64) *PostUpsertOne

AddViewCount adds v to the "view_count" field.

func (*PostUpsertOne) ClearApproved

func (u *PostUpsertOne) ClearApproved() *PostUpsertOne

ClearApproved clears the value of the "approved" field.

func (*PostUpsertOne) ClearDeletedAt

func (u *PostUpsertOne) ClearDeletedAt() *PostUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*PostUpsertOne) ClearDescription

func (u *PostUpsertOne) ClearDescription() *PostUpsertOne

ClearDescription clears the value of the "description" field.

func (*PostUpsertOne) ClearDraft

func (u *PostUpsertOne) ClearDraft() *PostUpsertOne

ClearDraft clears the value of the "draft" field.

func (*PostUpsertOne) ClearFeaturedImageID

func (u *PostUpsertOne) ClearFeaturedImageID() *PostUpsertOne

ClearFeaturedImageID clears the value of the "featured_image_id" field.

func (*PostUpsertOne) ClearRatingCount

func (u *PostUpsertOne) ClearRatingCount() *PostUpsertOne

ClearRatingCount clears the value of the "rating_count" field.

func (*PostUpsertOne) ClearRatingTotal

func (u *PostUpsertOne) ClearRatingTotal() *PostUpsertOne

ClearRatingTotal clears the value of the "rating_total" field.

func (*PostUpsertOne) ClearUserID

func (u *PostUpsertOne) ClearUserID() *PostUpsertOne

ClearUserID clears the value of the "user_id" 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 int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*PostUpsertOne) IDX

func (u *PostUpsertOne) IDX(ctx context.Context) int

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) SetApproved

func (u *PostUpsertOne) SetApproved(v bool) *PostUpsertOne

SetApproved sets the "approved" field.

func (*PostUpsertOne) SetCommentCount

func (u *PostUpsertOne) SetCommentCount(v int64) *PostUpsertOne

SetCommentCount sets the "comment_count" field.

func (*PostUpsertOne) SetContent

func (u *PostUpsertOne) SetContent(v string) *PostUpsertOne

SetContent sets the "content" field.

func (*PostUpsertOne) SetContentHTML

func (u *PostUpsertOne) SetContentHTML(v string) *PostUpsertOne

SetContentHTML sets the "content_html" 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) SetDescription

func (u *PostUpsertOne) SetDescription(v string) *PostUpsertOne

SetDescription sets the "description" field.

func (*PostUpsertOne) SetDraft

func (u *PostUpsertOne) SetDraft(v bool) *PostUpsertOne

SetDraft sets the "draft" field.

func (*PostUpsertOne) SetFeaturedImageID

func (u *PostUpsertOne) SetFeaturedImageID(v int) *PostUpsertOne

SetFeaturedImageID sets the "featured_image_id" field.

func (*PostUpsertOne) SetName

func (u *PostUpsertOne) SetName(v string) *PostUpsertOne

SetName sets the "name" field.

func (*PostUpsertOne) SetRatingCount

func (u *PostUpsertOne) SetRatingCount(v int64) *PostUpsertOne

SetRatingCount sets the "rating_count" field.

func (*PostUpsertOne) SetRatingTotal

func (u *PostUpsertOne) SetRatingTotal(v int64) *PostUpsertOne

SetRatingTotal sets the "rating_total" field.

func (*PostUpsertOne) SetSlug

func (u *PostUpsertOne) SetSlug(v string) *PostUpsertOne

SetSlug sets the "slug" field.

func (*PostUpsertOne) SetUpdatedAt

func (u *PostUpsertOne) SetUpdatedAt(v time.Time) *PostUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*PostUpsertOne) SetUserID

func (u *PostUpsertOne) SetUserID(v int) *PostUpsertOne

SetUserID sets the "user_id" field.

func (*PostUpsertOne) SetViewCount

func (u *PostUpsertOne) SetViewCount(v int64) *PostUpsertOne

SetViewCount sets the "view_count" 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) UpdateApproved

func (u *PostUpsertOne) UpdateApproved() *PostUpsertOne

UpdateApproved sets the "approved" field to the value that was provided on create.

func (*PostUpsertOne) UpdateCommentCount

func (u *PostUpsertOne) UpdateCommentCount() *PostUpsertOne

UpdateCommentCount sets the "comment_count" field to the value that was provided on create.

func (*PostUpsertOne) UpdateContent

func (u *PostUpsertOne) UpdateContent() *PostUpsertOne

UpdateContent sets the "content" field to the value that was provided on create.

func (*PostUpsertOne) UpdateContentHTML

func (u *PostUpsertOne) UpdateContentHTML() *PostUpsertOne

UpdateContentHTML sets the "content_html" 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) UpdateDescription

func (u *PostUpsertOne) UpdateDescription() *PostUpsertOne

UpdateDescription sets the "description" field to the value that was provided on create.

func (*PostUpsertOne) UpdateDraft

func (u *PostUpsertOne) UpdateDraft() *PostUpsertOne

UpdateDraft sets the "draft" field to the value that was provided on create.

func (*PostUpsertOne) UpdateFeaturedImageID

func (u *PostUpsertOne) UpdateFeaturedImageID() *PostUpsertOne

UpdateFeaturedImageID sets the "featured_image_id" field to the value that was provided on create.

func (*PostUpsertOne) UpdateName

func (u *PostUpsertOne) UpdateName() *PostUpsertOne

UpdateName sets the "name" 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. Using this option is equivalent to using:

client.Post.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*PostUpsertOne) UpdateRatingCount

func (u *PostUpsertOne) UpdateRatingCount() *PostUpsertOne

UpdateRatingCount sets the "rating_count" field to the value that was provided on create.

func (*PostUpsertOne) UpdateRatingTotal

func (u *PostUpsertOne) UpdateRatingTotal() *PostUpsertOne

UpdateRatingTotal sets the "rating_total" 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) UpdateUpdatedAt

func (u *PostUpsertOne) UpdateUpdatedAt() *PostUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*PostUpsertOne) UpdateUserID

func (u *PostUpsertOne) UpdateUserID() *PostUpsertOne

UpdateUserID sets the "user_id" field to the value that was provided on create.

func (*PostUpsertOne) UpdateViewCount

func (u *PostUpsertOne) UpdateViewCount() *PostUpsertOne

UpdateViewCount sets the "view_count" 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 Role

type Role struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt time.Time `json:"omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty" validate:"max=255"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty" validate:"max=255"`
	// Root holds the value of the "root" field.
	Root bool `json:"root,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) QueryPermissions

func (r *Role) QueryPermissions() *PermissionQuery

QueryPermissions queries the "permissions" edge of the Role entity.

func (*Role) QueryUsers

func (r *Role) QueryUsers() *UserQuery

QueryUsers queries the "users" 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 create builder for Role.

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 delete builder for the given entity.

func (*RoleClient) DeleteOneID

func (c *RoleClient) DeleteOneID(id int) *RoleDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*RoleClient) Get

func (c *RoleClient) Get(ctx context.Context, id int) (*Role, error)

Get returns a Role entity by its id.

func (*RoleClient) GetX

func (c *RoleClient) GetX(ctx context.Context, id int) *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) QueryPermissions

func (c *RoleClient) QueryPermissions(r *Role) *PermissionQuery

QueryPermissions queries the permissions edge of a Role.

func (*RoleClient) QueryUsers

func (c *RoleClient) QueryUsers(r *Role) *UserQuery

QueryUsers queries the users 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 int) *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) AddPermissionIDs

func (rc *RoleCreate) AddPermissionIDs(ids ...int) *RoleCreate

AddPermissionIDs adds the "permissions" edge to the Permission entity by IDs.

func (*RoleCreate) AddPermissions

func (rc *RoleCreate) AddPermissions(p ...*Permission) *RoleCreate

AddPermissions adds the "permissions" edges to the Permission entity.

func (*RoleCreate) AddUserIDs

func (rc *RoleCreate) AddUserIDs(ids ...int) *RoleCreate

AddUserIDs adds the "users" edge to the User entity by IDs.

func (*RoleCreate) AddUsers

func (rc *RoleCreate) AddUsers(u ...*User) *RoleCreate

AddUsers adds the "users" edges to the User 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) SetDeletedAt

func (rc *RoleCreate) SetDeletedAt(t time.Time) *RoleCreate

SetDeletedAt sets the "deleted_at" field.

func (*RoleCreate) SetDescription

func (rc *RoleCreate) SetDescription(s string) *RoleCreate

SetDescription sets the "description" 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) SetNillableDeletedAt

func (rc *RoleCreate) SetNillableDeletedAt(t *time.Time) *RoleCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*RoleCreate) SetNillableDescription

func (rc *RoleCreate) SetNillableDescription(s *string) *RoleCreate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*RoleCreate) SetNillableRoot

func (rc *RoleCreate) SetNillableRoot(b *bool) *RoleCreate

SetNillableRoot sets the "root" 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) SetRoot

func (rc *RoleCreate) SetRoot(b bool) *RoleCreate

SetRoot sets the "root" field.

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 {
	// Permissions holds the value of the permissions edge.
	Permissions []*Permission `json:"permissions,omitempty"`
	// Users holds the value of the users edge.
	Users []*User `json:"users,omitempty"`
	// contains filtered or unexported fields
}

RoleEdges holds the relations/edges for other nodes in the graph.

func (RoleEdges) PermissionsOrErr

func (e RoleEdges) PermissionsOrErr() ([]*Permission, error)

PermissionsOrErr returns the Permissions value or an error if the edge was not loaded in eager-loading.

func (RoleEdges) UsersOrErr

func (e RoleEdges) UsersOrErr() ([]*User, error)

UsersOrErr returns the Users value or an error if the edge was not loaded in eager-loading.

type RoleFilter

type RoleFilter struct {
	// contains filtered or unexported fields
}

RoleFilter provides a generic filtering capability at runtime for RoleQuery.

func (*RoleFilter) Where

func (f *RoleFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*RoleFilter) WhereCreatedAt

func (f *RoleFilter) WhereCreatedAt(p entql.TimeP)

WhereCreatedAt applies the entql time.Time predicate on the created_at field.

func (*RoleFilter) WhereDeletedAt

func (f *RoleFilter) WhereDeletedAt(p entql.TimeP)

WhereDeletedAt applies the entql time.Time predicate on the deleted_at field.

func (*RoleFilter) WhereDescription

func (f *RoleFilter) WhereDescription(p entql.StringP)

WhereDescription applies the entql string predicate on the description field.

func (*RoleFilter) WhereHasPermissions

func (f *RoleFilter) WhereHasPermissions()

WhereHasPermissions applies a predicate to check if query has an edge permissions.

func (*RoleFilter) WhereHasPermissionsWith

func (f *RoleFilter) WhereHasPermissionsWith(preds ...predicate.Permission)

WhereHasPermissionsWith applies a predicate to check if query has an edge permissions with a given conditions (other predicates).

func (*RoleFilter) WhereHasUsers

func (f *RoleFilter) WhereHasUsers()

WhereHasUsers applies a predicate to check if query has an edge users.

func (*RoleFilter) WhereHasUsersWith

func (f *RoleFilter) WhereHasUsersWith(preds ...predicate.User)

WhereHasUsersWith applies a predicate to check if query has an edge users with a given conditions (other predicates).

func (*RoleFilter) WhereID

func (f *RoleFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*RoleFilter) WhereName

func (f *RoleFilter) WhereName(p entql.StringP)

WhereName applies the entql string predicate on the name field.

func (*RoleFilter) WhereRoot

func (f *RoleFilter) WhereRoot(p entql.BoolP)

WhereRoot applies the entql bool predicate on the root field.

func (*RoleFilter) WhereUpdatedAt

func (f *RoleFilter) WhereUpdatedAt(p entql.TimeP)

WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.

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 (rgb *RoleGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) BoolX

func (rgb *RoleGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*RoleGroupBy) Bools

func (rgb *RoleGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) BoolsX

func (rgb *RoleGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*RoleGroupBy) Float64

func (rgb *RoleGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) Float64X

func (rgb *RoleGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*RoleGroupBy) Float64s

func (rgb *RoleGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) Float64sX

func (rgb *RoleGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*RoleGroupBy) Int

func (rgb *RoleGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) IntX

func (rgb *RoleGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*RoleGroupBy) Ints

func (rgb *RoleGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) IntsX

func (rgb *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 (rgb *RoleGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*RoleGroupBy) String

func (rgb *RoleGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) StringX

func (rgb *RoleGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*RoleGroupBy) Strings

func (rgb *RoleGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*RoleGroupBy) StringsX

func (rgb *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) 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) AddPermissionIDs

func (m *RoleMutation) AddPermissionIDs(ids ...int)

AddPermissionIDs adds the "permissions" edge to the Permission entity by ids.

func (*RoleMutation) AddUserIDs

func (m *RoleMutation) AddUserIDs(ids ...int)

AddUserIDs adds the "users" edge to the User entity by ids.

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) ClearDeletedAt

func (m *RoleMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*RoleMutation) ClearDescription

func (m *RoleMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

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) ClearPermissions

func (m *RoleMutation) ClearPermissions()

ClearPermissions clears the "permissions" edge to the Permission entity.

func (*RoleMutation) ClearRoot

func (m *RoleMutation) ClearRoot()

ClearRoot clears the value of the "root" field.

func (*RoleMutation) ClearUsers

func (m *RoleMutation) ClearUsers()

ClearUsers clears the "users" edge to the User entity.

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) DeletedAt

func (m *RoleMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*RoleMutation) DeletedAtCleared

func (m *RoleMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*RoleMutation) Description

func (m *RoleMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*RoleMutation) DescriptionCleared

func (m *RoleMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this 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) Filter

func (m *RoleMutation) Filter() *RoleFilter

Filter returns an entql.Where implementation to apply filters on the RoleMutation builder.

func (*RoleMutation) ID

func (m *RoleMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*RoleMutation) IDs

func (m *RoleMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*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) OldDeletedAt

func (m *RoleMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error)

OldDeletedAt returns the old "deleted_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) OldDescription

func (m *RoleMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old "description" 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) OldRoot

func (m *RoleMutation) OldRoot(ctx context.Context) (v bool, err error)

OldRoot returns the old "root" 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) PermissionsCleared

func (m *RoleMutation) PermissionsCleared() bool

PermissionsCleared reports if the "permissions" edge to the Permission entity was cleared.

func (*RoleMutation) PermissionsIDs

func (m *RoleMutation) PermissionsIDs() (ids []int)

PermissionsIDs returns the "permissions" edge IDs in the mutation.

func (*RoleMutation) RemovePermissionIDs

func (m *RoleMutation) RemovePermissionIDs(ids ...int)

RemovePermissionIDs removes the "permissions" edge to the Permission entity by IDs.

func (*RoleMutation) RemoveUserIDs

func (m *RoleMutation) RemoveUserIDs(ids ...int)

RemoveUserIDs removes the "users" edge to the User entity by IDs.

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) RemovedPermissionsIDs

func (m *RoleMutation) RemovedPermissionsIDs() (ids []int)

RemovedPermissions returns the removed IDs of the "permissions" edge to the Permission entity.

func (*RoleMutation) RemovedUsersIDs

func (m *RoleMutation) RemovedUsersIDs() (ids []int)

RemovedUsers returns the removed IDs of the "users" edge to the User entity.

func (*RoleMutation) ResetCreatedAt

func (m *RoleMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*RoleMutation) ResetDeletedAt

func (m *RoleMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*RoleMutation) ResetDescription

func (m *RoleMutation) ResetDescription()

ResetDescription resets all changes to the "description" 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) ResetPermissions

func (m *RoleMutation) ResetPermissions()

ResetPermissions resets all changes to the "permissions" edge.

func (*RoleMutation) ResetRoot

func (m *RoleMutation) ResetRoot()

ResetRoot resets all changes to the "root" field.

func (*RoleMutation) ResetUpdatedAt

func (m *RoleMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*RoleMutation) ResetUsers

func (m *RoleMutation) ResetUsers()

ResetUsers resets all changes to the "users" edge.

func (*RoleMutation) Root

func (m *RoleMutation) Root() (r bool, exists bool)

Root returns the value of the "root" field in the mutation.

func (*RoleMutation) RootCleared

func (m *RoleMutation) RootCleared() bool

RootCleared returns if the "root" field was cleared in this mutation.

func (*RoleMutation) SetCreatedAt

func (m *RoleMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*RoleMutation) SetDeletedAt

func (m *RoleMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*RoleMutation) SetDescription

func (m *RoleMutation) SetDescription(s string)

SetDescription sets the "description" 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) SetName

func (m *RoleMutation) SetName(s string)

SetName sets the "name" field.

func (*RoleMutation) SetRoot

func (m *RoleMutation) SetRoot(b bool)

SetRoot sets the "root" 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) UsersCleared

func (m *RoleMutation) UsersCleared() bool

UsersCleared reports if the "users" edge to the User entity was cleared.

func (*RoleMutation) UsersIDs

func (m *RoleMutation) UsersIDs() (ids []int)

UsersIDs returns the "users" edge IDs 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) Filter

func (rq *RoleQuery) Filter() *RoleFilter

Filter returns a Filter implementation to apply filters on the RoleQuery builder.

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 int, 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) int

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:"omitempty"`
	Count int `json:"count,omitempty"`
}

client.Role.Query().
	GroupBy(role.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RoleQuery) IDs

func (rq *RoleQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Role IDs.

func (*RoleQuery) IDsX

func (rq *RoleQuery) IDsX(ctx context.Context) []int

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) 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 int, 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) int

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) QueryPermissions

func (rq *RoleQuery) QueryPermissions() *PermissionQuery

QueryPermissions chains the current query on the "permissions" edge.

func (*RoleQuery) QueryUsers

func (rq *RoleQuery) QueryUsers() *UserQuery

QueryUsers chains the current query on the "users" 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:"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) WithPermissions

func (rq *RoleQuery) WithPermissions(opts ...func(*PermissionQuery)) *RoleQuery

WithPermissions tells the query-builder to eager-load the nodes that are connected to the "permissions" edge. The optional arguments are used to configure the query builder of the edge.

func (*RoleQuery) WithUsers

func (rq *RoleQuery) WithUsers(opts ...func(*UserQuery)) *RoleQuery

WithUsers tells the query-builder to eager-load the nodes that are connected to the "users" edge. The optional arguments are used to configure the query builder of the edge.

type RoleSelect

type RoleSelect struct {
	*RoleQuery
	// contains filtered or unexported fields
}

RoleSelect is the builder for selecting fields of Role entities.

func (*RoleSelect) Bool

func (rs *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 (rs *RoleSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*RoleSelect) Bools

func (rs *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 (rs *RoleSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*RoleSelect) Float64

func (rs *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 (rs *RoleSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*RoleSelect) Float64s

func (rs *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 (rs *RoleSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*RoleSelect) Int

func (rs *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 (rs *RoleSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*RoleSelect) Ints

func (rs *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 (rs *RoleSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

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 (rs *RoleSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*RoleSelect) String

func (rs *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 (rs *RoleSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*RoleSelect) Strings

func (rs *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 (rs *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) AddPermissionIDs

func (ru *RoleUpdate) AddPermissionIDs(ids ...int) *RoleUpdate

AddPermissionIDs adds the "permissions" edge to the Permission entity by IDs.

func (*RoleUpdate) AddPermissions

func (ru *RoleUpdate) AddPermissions(p ...*Permission) *RoleUpdate

AddPermissions adds the "permissions" edges to the Permission entity.

func (*RoleUpdate) AddUserIDs

func (ru *RoleUpdate) AddUserIDs(ids ...int) *RoleUpdate

AddUserIDs adds the "users" edge to the User entity by IDs.

func (*RoleUpdate) AddUsers

func (ru *RoleUpdate) AddUsers(u ...*User) *RoleUpdate

AddUsers adds the "users" edges to the User entity.

func (*RoleUpdate) ClearDeletedAt

func (ru *RoleUpdate) ClearDeletedAt() *RoleUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*RoleUpdate) ClearDescription

func (ru *RoleUpdate) ClearDescription() *RoleUpdate

ClearDescription clears the value of the "description" field.

func (*RoleUpdate) ClearPermissions

func (ru *RoleUpdate) ClearPermissions() *RoleUpdate

ClearPermissions clears all "permissions" edges to the Permission entity.

func (*RoleUpdate) ClearRoot

func (ru *RoleUpdate) ClearRoot() *RoleUpdate

ClearRoot clears the value of the "root" field.

func (*RoleUpdate) ClearUsers

func (ru *RoleUpdate) ClearUsers() *RoleUpdate

ClearUsers clears all "users" edges to the User 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) Mutation

func (ru *RoleUpdate) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleUpdate) RemovePermissionIDs

func (ru *RoleUpdate) RemovePermissionIDs(ids ...int) *RoleUpdate

RemovePermissionIDs removes the "permissions" edge to Permission entities by IDs.

func (*RoleUpdate) RemovePermissions

func (ru *RoleUpdate) RemovePermissions(p ...*Permission) *RoleUpdate

RemovePermissions removes "permissions" edges to Permission entities.

func (*RoleUpdate) RemoveUserIDs

func (ru *RoleUpdate) RemoveUserIDs(ids ...int) *RoleUpdate

RemoveUserIDs removes the "users" edge to User entities by IDs.

func (*RoleUpdate) RemoveUsers

func (ru *RoleUpdate) RemoveUsers(u ...*User) *RoleUpdate

RemoveUsers removes "users" edges to User 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) SetDeletedAt

func (ru *RoleUpdate) SetDeletedAt(t time.Time) *RoleUpdate

SetDeletedAt sets the "deleted_at" field.

func (*RoleUpdate) SetDescription

func (ru *RoleUpdate) SetDescription(s string) *RoleUpdate

SetDescription sets the "description" field.

func (*RoleUpdate) SetName

func (ru *RoleUpdate) SetName(s string) *RoleUpdate

SetName sets the "name" field.

func (*RoleUpdate) SetNillableDeletedAt

func (ru *RoleUpdate) SetNillableDeletedAt(t *time.Time) *RoleUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*RoleUpdate) SetNillableDescription

func (ru *RoleUpdate) SetNillableDescription(s *string) *RoleUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*RoleUpdate) SetNillableRoot

func (ru *RoleUpdate) SetNillableRoot(b *bool) *RoleUpdate

SetNillableRoot sets the "root" field if the given value is not nil.

func (*RoleUpdate) SetRoot

func (ru *RoleUpdate) SetRoot(b bool) *RoleUpdate

SetRoot sets the "root" 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) AddPermissionIDs

func (ruo *RoleUpdateOne) AddPermissionIDs(ids ...int) *RoleUpdateOne

AddPermissionIDs adds the "permissions" edge to the Permission entity by IDs.

func (*RoleUpdateOne) AddPermissions

func (ruo *RoleUpdateOne) AddPermissions(p ...*Permission) *RoleUpdateOne

AddPermissions adds the "permissions" edges to the Permission entity.

func (*RoleUpdateOne) AddUserIDs

func (ruo *RoleUpdateOne) AddUserIDs(ids ...int) *RoleUpdateOne

AddUserIDs adds the "users" edge to the User entity by IDs.

func (*RoleUpdateOne) AddUsers

func (ruo *RoleUpdateOne) AddUsers(u ...*User) *RoleUpdateOne

AddUsers adds the "users" edges to the User entity.

func (*RoleUpdateOne) ClearDeletedAt

func (ruo *RoleUpdateOne) ClearDeletedAt() *RoleUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*RoleUpdateOne) ClearDescription

func (ruo *RoleUpdateOne) ClearDescription() *RoleUpdateOne

ClearDescription clears the value of the "description" field.

func (*RoleUpdateOne) ClearPermissions

func (ruo *RoleUpdateOne) ClearPermissions() *RoleUpdateOne

ClearPermissions clears all "permissions" edges to the Permission entity.

func (*RoleUpdateOne) ClearRoot

func (ruo *RoleUpdateOne) ClearRoot() *RoleUpdateOne

ClearRoot clears the value of the "root" field.

func (*RoleUpdateOne) ClearUsers

func (ruo *RoleUpdateOne) ClearUsers() *RoleUpdateOne

ClearUsers clears all "users" edges to the User 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) Mutation

func (ruo *RoleUpdateOne) Mutation() *RoleMutation

Mutation returns the RoleMutation object of the builder.

func (*RoleUpdateOne) RemovePermissionIDs

func (ruo *RoleUpdateOne) RemovePermissionIDs(ids ...int) *RoleUpdateOne

RemovePermissionIDs removes the "permissions" edge to Permission entities by IDs.

func (*RoleUpdateOne) RemovePermissions

func (ruo *RoleUpdateOne) RemovePermissions(p ...*Permission) *RoleUpdateOne

RemovePermissions removes "permissions" edges to Permission entities.

func (*RoleUpdateOne) RemoveUserIDs

func (ruo *RoleUpdateOne) RemoveUserIDs(ids ...int) *RoleUpdateOne

RemoveUserIDs removes the "users" edge to User entities by IDs.

func (*RoleUpdateOne) RemoveUsers

func (ruo *RoleUpdateOne) RemoveUsers(u ...*User) *RoleUpdateOne

RemoveUsers removes "users" edges to User 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) SetDeletedAt

func (ruo *RoleUpdateOne) SetDeletedAt(t time.Time) *RoleUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*RoleUpdateOne) SetDescription

func (ruo *RoleUpdateOne) SetDescription(s string) *RoleUpdateOne

SetDescription sets the "description" field.

func (*RoleUpdateOne) SetName

func (ruo *RoleUpdateOne) SetName(s string) *RoleUpdateOne

SetName sets the "name" field.

func (*RoleUpdateOne) SetNillableDeletedAt

func (ruo *RoleUpdateOne) SetNillableDeletedAt(t *time.Time) *RoleUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableDescription

func (ruo *RoleUpdateOne) SetNillableDescription(s *string) *RoleUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*RoleUpdateOne) SetNillableRoot

func (ruo *RoleUpdateOne) SetNillableRoot(b *bool) *RoleUpdateOne

SetNillableRoot sets the "root" field if the given value is not nil.

func (*RoleUpdateOne) SetRoot

func (ruo *RoleUpdateOne) SetRoot(b bool) *RoleUpdateOne

SetRoot sets the "root" 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) ClearDeletedAt

func (u *RoleUpsert) ClearDeletedAt() *RoleUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*RoleUpsert) ClearDescription

func (u *RoleUpsert) ClearDescription() *RoleUpsert

ClearDescription clears the value of the "description" field.

func (*RoleUpsert) ClearRoot

func (u *RoleUpsert) ClearRoot() *RoleUpsert

ClearRoot clears the value of the "root" field.

func (*RoleUpsert) SetCreatedAt

func (u *RoleUpsert) SetCreatedAt(v time.Time) *RoleUpsert

SetCreatedAt sets the "created_at" field.

func (*RoleUpsert) SetDeletedAt

func (u *RoleUpsert) SetDeletedAt(v time.Time) *RoleUpsert

SetDeletedAt sets the "deleted_at" field.

func (*RoleUpsert) SetDescription

func (u *RoleUpsert) SetDescription(v string) *RoleUpsert

SetDescription sets the "description" field.

func (*RoleUpsert) SetName

func (u *RoleUpsert) SetName(v string) *RoleUpsert

SetName sets the "name" field.

func (*RoleUpsert) SetRoot

func (u *RoleUpsert) SetRoot(v bool) *RoleUpsert

SetRoot sets the "root" 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) UpdateDeletedAt

func (u *RoleUpsert) UpdateDeletedAt() *RoleUpsert

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*RoleUpsert) UpdateDescription

func (u *RoleUpsert) UpdateDescription() *RoleUpsert

UpdateDescription sets the "description" 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) UpdateRoot

func (u *RoleUpsert) UpdateRoot() *RoleUpsert

UpdateRoot sets the "root" 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) ClearDeletedAt

func (u *RoleUpsertBulk) ClearDeletedAt() *RoleUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*RoleUpsertBulk) ClearDescription

func (u *RoleUpsertBulk) ClearDescription() *RoleUpsertBulk

ClearDescription clears the value of the "description" field.

func (*RoleUpsertBulk) ClearRoot

func (u *RoleUpsertBulk) ClearRoot() *RoleUpsertBulk

ClearRoot clears the value of the "root" field.

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) SetDeletedAt

func (u *RoleUpsertBulk) SetDeletedAt(v time.Time) *RoleUpsertBulk

SetDeletedAt sets the "deleted_at" field.

func (*RoleUpsertBulk) SetDescription

func (u *RoleUpsertBulk) SetDescription(v string) *RoleUpsertBulk

SetDescription sets the "description" field.

func (*RoleUpsertBulk) SetName

func (u *RoleUpsertBulk) SetName(v string) *RoleUpsertBulk

SetName sets the "name" field.

func (*RoleUpsertBulk) SetRoot

func (u *RoleUpsertBulk) SetRoot(v bool) *RoleUpsertBulk

SetRoot sets the "root" 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) UpdateDeletedAt

func (u *RoleUpsertBulk) UpdateDeletedAt() *RoleUpsertBulk

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*RoleUpsertBulk) UpdateDescription

func (u *RoleUpsertBulk) UpdateDescription() *RoleUpsertBulk

UpdateDescription sets the "description" 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(),
	).
	Exec(ctx)

func (*RoleUpsertBulk) UpdateRoot

func (u *RoleUpsertBulk) UpdateRoot() *RoleUpsertBulk

UpdateRoot sets the "root" field to the value that was provided on create.

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) ClearDeletedAt

func (u *RoleUpsertOne) ClearDeletedAt() *RoleUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*RoleUpsertOne) ClearDescription

func (u *RoleUpsertOne) ClearDescription() *RoleUpsertOne

ClearDescription clears the value of the "description" field.

func (*RoleUpsertOne) ClearRoot

func (u *RoleUpsertOne) ClearRoot() *RoleUpsertOne

ClearRoot clears the value of the "root" field.

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 int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*RoleUpsertOne) IDX

func (u *RoleUpsertOne) IDX(ctx context.Context) int

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) SetDeletedAt

func (u *RoleUpsertOne) SetDeletedAt(v time.Time) *RoleUpsertOne

SetDeletedAt sets the "deleted_at" field.

func (*RoleUpsertOne) SetDescription

func (u *RoleUpsertOne) SetDescription(v string) *RoleUpsertOne

SetDescription sets the "description" field.

func (*RoleUpsertOne) SetName

func (u *RoleUpsertOne) SetName(v string) *RoleUpsertOne

SetName sets the "name" field.

func (*RoleUpsertOne) SetRoot

func (u *RoleUpsertOne) SetRoot(v bool) *RoleUpsertOne

SetRoot sets the "root" 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) UpdateDeletedAt

func (u *RoleUpsertOne) UpdateDeletedAt() *RoleUpsertOne

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*RoleUpsertOne) UpdateDescription

func (u *RoleUpsertOne) UpdateDescription() *RoleUpsertOne

UpdateDescription sets the "description" 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. Using this option is equivalent to using:

client.Role.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*RoleUpsertOne) UpdateRoot

func (u *RoleUpsertOne) UpdateRoot() *RoleUpsertOne

UpdateRoot sets the "root" field to the value that was provided on create.

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 Setting

type Setting struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt time.Time `json:"omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Value holds the value of the "value" field.
	Value string `json:"value,omitempty"`
	// Type holds the value of the "type" field.
	Type string `json:"type,omitempty"`
	// contains filtered or unexported fields
}

Setting is the model entity for the Setting schema.

func (*Setting) String

func (s *Setting) String() string

String implements the fmt.Stringer.

func (*Setting) Unwrap

func (s *Setting) Unwrap() *Setting

Unwrap unwraps the Setting 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 (*Setting) Update

func (s *Setting) Update() *SettingUpdateOne

Update returns a builder for updating this Setting. Note that you need to call Setting.Unwrap() before calling this method if this Setting was returned from a transaction, and the transaction was committed or rolled back.

type SettingClient

type SettingClient struct {
	// contains filtered or unexported fields
}

SettingClient is a client for the Setting schema.

func NewSettingClient

func NewSettingClient(c config) *SettingClient

NewSettingClient returns a client for the Setting from the given config.

func (*SettingClient) Create

func (c *SettingClient) Create() *SettingCreate

Create returns a create builder for Setting.

func (*SettingClient) CreateBulk

func (c *SettingClient) CreateBulk(builders ...*SettingCreate) *SettingCreateBulk

CreateBulk returns a builder for creating a bulk of Setting entities.

func (*SettingClient) Delete

func (c *SettingClient) Delete() *SettingDelete

Delete returns a delete builder for Setting.

func (*SettingClient) DeleteOne

func (c *SettingClient) DeleteOne(s *Setting) *SettingDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*SettingClient) DeleteOneID

func (c *SettingClient) DeleteOneID(id int) *SettingDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*SettingClient) Get

func (c *SettingClient) Get(ctx context.Context, id int) (*Setting, error)

Get returns a Setting entity by its id.

func (*SettingClient) GetX

func (c *SettingClient) GetX(ctx context.Context, id int) *Setting

GetX is like Get, but panics if an error occurs.

func (*SettingClient) Hooks

func (c *SettingClient) Hooks() []Hook

Hooks returns the client hooks.

func (*SettingClient) Query

func (c *SettingClient) Query() *SettingQuery

Query returns a query builder for Setting.

func (*SettingClient) Update

func (c *SettingClient) Update() *SettingUpdate

Update returns an update builder for Setting.

func (*SettingClient) UpdateOne

func (c *SettingClient) UpdateOne(s *Setting) *SettingUpdateOne

UpdateOne returns an update builder for the given entity.

func (*SettingClient) UpdateOneID

func (c *SettingClient) UpdateOneID(id int) *SettingUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SettingClient) Use

func (c *SettingClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `setting.Hooks(f(g(h())))`.

type SettingCreate

type SettingCreate struct {
	// contains filtered or unexported fields
}

SettingCreate is the builder for creating a Setting entity.

func (*SettingCreate) Exec

func (sc *SettingCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*SettingCreate) ExecX

func (sc *SettingCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SettingCreate) Mutation

func (sc *SettingCreate) Mutation() *SettingMutation

Mutation returns the SettingMutation object of the builder.

func (*SettingCreate) OnConflict

func (sc *SettingCreate) OnConflict(opts ...sql.ConflictOption) *SettingUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Setting.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.SettingUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*SettingCreate) OnConflictColumns

func (sc *SettingCreate) OnConflictColumns(columns ...string) *SettingUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Setting.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*SettingCreate) Save

func (sc *SettingCreate) Save(ctx context.Context) (*Setting, error)

Save creates the Setting in the database.

func (*SettingCreate) SaveX

func (sc *SettingCreate) SaveX(ctx context.Context) *Setting

SaveX calls Save and panics if Save returns an error.

func (*SettingCreate) SetCreatedAt

func (sc *SettingCreate) SetCreatedAt(t time.Time) *SettingCreate

SetCreatedAt sets the "created_at" field.

func (*SettingCreate) SetDeletedAt

func (sc *SettingCreate) SetDeletedAt(t time.Time) *SettingCreate

SetDeletedAt sets the "deleted_at" field.

func (*SettingCreate) SetName

func (sc *SettingCreate) SetName(s string) *SettingCreate

SetName sets the "name" field.

func (*SettingCreate) SetNillableCreatedAt

func (sc *SettingCreate) SetNillableCreatedAt(t *time.Time) *SettingCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*SettingCreate) SetNillableDeletedAt

func (sc *SettingCreate) SetNillableDeletedAt(t *time.Time) *SettingCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*SettingCreate) SetNillableType

func (sc *SettingCreate) SetNillableType(s *string) *SettingCreate

SetNillableType sets the "type" field if the given value is not nil.

func (*SettingCreate) SetNillableUpdatedAt

func (sc *SettingCreate) SetNillableUpdatedAt(t *time.Time) *SettingCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*SettingCreate) SetNillableValue

func (sc *SettingCreate) SetNillableValue(s *string) *SettingCreate

SetNillableValue sets the "value" field if the given value is not nil.

func (*SettingCreate) SetType

func (sc *SettingCreate) SetType(s string) *SettingCreate

SetType sets the "type" field.

func (*SettingCreate) SetUpdatedAt

func (sc *SettingCreate) SetUpdatedAt(t time.Time) *SettingCreate

SetUpdatedAt sets the "updated_at" field.

func (*SettingCreate) SetValue

func (sc *SettingCreate) SetValue(s string) *SettingCreate

SetValue sets the "value" field.

type SettingCreateBulk

type SettingCreateBulk struct {
	// contains filtered or unexported fields
}

SettingCreateBulk is the builder for creating many Setting entities in bulk.

func (*SettingCreateBulk) Exec

func (scb *SettingCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*SettingCreateBulk) ExecX

func (scb *SettingCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SettingCreateBulk) OnConflict

func (scb *SettingCreateBulk) OnConflict(opts ...sql.ConflictOption) *SettingUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Setting.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.SettingUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*SettingCreateBulk) OnConflictColumns

func (scb *SettingCreateBulk) OnConflictColumns(columns ...string) *SettingUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Setting.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*SettingCreateBulk) Save

func (scb *SettingCreateBulk) Save(ctx context.Context) ([]*Setting, error)

Save creates the Setting entities in the database.

func (*SettingCreateBulk) SaveX

func (scb *SettingCreateBulk) SaveX(ctx context.Context) []*Setting

SaveX is like Save, but panics if an error occurs.

type SettingDelete

type SettingDelete struct {
	// contains filtered or unexported fields
}

SettingDelete is the builder for deleting a Setting entity.

func (*SettingDelete) Exec

func (sd *SettingDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*SettingDelete) ExecX

func (sd *SettingDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*SettingDelete) Where

func (sd *SettingDelete) Where(ps ...predicate.Setting) *SettingDelete

Where appends a list predicates to the SettingDelete builder.

type SettingDeleteOne

type SettingDeleteOne struct {
	// contains filtered or unexported fields
}

SettingDeleteOne is the builder for deleting a single Setting entity.

func (*SettingDeleteOne) Exec

func (sdo *SettingDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*SettingDeleteOne) ExecX

func (sdo *SettingDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type SettingFilter

type SettingFilter struct {
	// contains filtered or unexported fields
}

SettingFilter provides a generic filtering capability at runtime for SettingQuery.

func (*SettingFilter) Where

func (f *SettingFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*SettingFilter) WhereCreatedAt

func (f *SettingFilter) WhereCreatedAt(p entql.TimeP)

WhereCreatedAt applies the entql time.Time predicate on the created_at field.

func (*SettingFilter) WhereDeletedAt

func (f *SettingFilter) WhereDeletedAt(p entql.TimeP)

WhereDeletedAt applies the entql time.Time predicate on the deleted_at field.

func (*SettingFilter) WhereID

func (f *SettingFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*SettingFilter) WhereName

func (f *SettingFilter) WhereName(p entql.StringP)

WhereName applies the entql string predicate on the name field.

func (*SettingFilter) WhereType

func (f *SettingFilter) WhereType(p entql.StringP)

WhereType applies the entql string predicate on the type field.

func (*SettingFilter) WhereUpdatedAt

func (f *SettingFilter) WhereUpdatedAt(p entql.TimeP)

WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.

func (*SettingFilter) WhereValue

func (f *SettingFilter) WhereValue(p entql.StringP)

WhereValue applies the entql string predicate on the value field.

type SettingGroupBy

type SettingGroupBy struct {
	// contains filtered or unexported fields
}

SettingGroupBy is the group-by builder for Setting entities.

func (*SettingGroupBy) Aggregate

func (sgb *SettingGroupBy) Aggregate(fns ...AggregateFunc) *SettingGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*SettingGroupBy) Bool

func (sgb *SettingGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*SettingGroupBy) BoolX

func (sgb *SettingGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*SettingGroupBy) Bools

func (sgb *SettingGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*SettingGroupBy) BoolsX

func (sgb *SettingGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*SettingGroupBy) Float64

func (sgb *SettingGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*SettingGroupBy) Float64X

func (sgb *SettingGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*SettingGroupBy) Float64s

func (sgb *SettingGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*SettingGroupBy) Float64sX

func (sgb *SettingGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*SettingGroupBy) Int

func (sgb *SettingGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*SettingGroupBy) IntX

func (sgb *SettingGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*SettingGroupBy) Ints

func (sgb *SettingGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*SettingGroupBy) IntsX

func (sgb *SettingGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*SettingGroupBy) Scan

func (sgb *SettingGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*SettingGroupBy) ScanX

func (sgb *SettingGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*SettingGroupBy) String

func (sgb *SettingGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*SettingGroupBy) StringX

func (sgb *SettingGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*SettingGroupBy) Strings

func (sgb *SettingGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*SettingGroupBy) StringsX

func (sgb *SettingGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type SettingMutation

type SettingMutation struct {
	// contains filtered or unexported fields
}

SettingMutation represents an operation that mutates the Setting nodes in the graph.

func (*SettingMutation) AddField

func (m *SettingMutation) 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 (*SettingMutation) AddedEdges

func (m *SettingMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*SettingMutation) AddedField

func (m *SettingMutation) 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 (*SettingMutation) AddedFields

func (m *SettingMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*SettingMutation) AddedIDs

func (m *SettingMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*SettingMutation) ClearDeletedAt

func (m *SettingMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*SettingMutation) ClearEdge

func (m *SettingMutation) 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 (*SettingMutation) ClearField

func (m *SettingMutation) 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 (*SettingMutation) ClearType

func (m *SettingMutation) ClearType()

ClearType clears the value of the "type" field.

func (*SettingMutation) ClearValue

func (m *SettingMutation) ClearValue()

ClearValue clears the value of the "value" field.

func (*SettingMutation) ClearedEdges

func (m *SettingMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*SettingMutation) ClearedFields

func (m *SettingMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (SettingMutation) Client

func (m SettingMutation) 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 (*SettingMutation) CreatedAt

func (m *SettingMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*SettingMutation) DeletedAt

func (m *SettingMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*SettingMutation) DeletedAtCleared

func (m *SettingMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*SettingMutation) EdgeCleared

func (m *SettingMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*SettingMutation) Field

func (m *SettingMutation) 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 (*SettingMutation) FieldCleared

func (m *SettingMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*SettingMutation) Fields

func (m *SettingMutation) 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 (*SettingMutation) Filter

func (m *SettingMutation) Filter() *SettingFilter

Filter returns an entql.Where implementation to apply filters on the SettingMutation builder.

func (*SettingMutation) GetType

func (m *SettingMutation) GetType() (r string, exists bool)

GetType returns the value of the "type" field in the mutation.

func (*SettingMutation) ID

func (m *SettingMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*SettingMutation) IDs

func (m *SettingMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*SettingMutation) Name

func (m *SettingMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*SettingMutation) OldCreatedAt

func (m *SettingMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Setting entity. If the Setting 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 (*SettingMutation) OldDeletedAt

func (m *SettingMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the Setting entity. If the Setting 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 (*SettingMutation) OldField

func (m *SettingMutation) 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 (*SettingMutation) OldName

func (m *SettingMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Setting entity. If the Setting 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 (*SettingMutation) OldType

func (m *SettingMutation) OldType(ctx context.Context) (v string, err error)

OldType returns the old "type" field's value of the Setting entity. If the Setting 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 (*SettingMutation) OldUpdatedAt

func (m *SettingMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Setting entity. If the Setting 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 (*SettingMutation) OldValue

func (m *SettingMutation) OldValue(ctx context.Context) (v string, err error)

OldValue returns the old "value" field's value of the Setting entity. If the Setting 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 (*SettingMutation) Op

func (m *SettingMutation) Op() Op

Op returns the operation name.

func (*SettingMutation) RemovedEdges

func (m *SettingMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*SettingMutation) RemovedIDs

func (m *SettingMutation) 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 (*SettingMutation) ResetCreatedAt

func (m *SettingMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*SettingMutation) ResetDeletedAt

func (m *SettingMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*SettingMutation) ResetEdge

func (m *SettingMutation) 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 (*SettingMutation) ResetField

func (m *SettingMutation) 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 (*SettingMutation) ResetName

func (m *SettingMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*SettingMutation) ResetType

func (m *SettingMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*SettingMutation) ResetUpdatedAt

func (m *SettingMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*SettingMutation) ResetValue

func (m *SettingMutation) ResetValue()

ResetValue resets all changes to the "value" field.

func (*SettingMutation) SetCreatedAt

func (m *SettingMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*SettingMutation) SetDeletedAt

func (m *SettingMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*SettingMutation) SetField

func (m *SettingMutation) 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 (*SettingMutation) SetName

func (m *SettingMutation) SetName(s string)

SetName sets the "name" field.

func (*SettingMutation) SetType

func (m *SettingMutation) SetType(s string)

SetType sets the "type" field.

func (*SettingMutation) SetUpdatedAt

func (m *SettingMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*SettingMutation) SetValue

func (m *SettingMutation) SetValue(s string)

SetValue sets the "value" field.

func (SettingMutation) Tx

func (m SettingMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*SettingMutation) Type

func (m *SettingMutation) Type() string

Type returns the node type of this mutation (Setting).

func (*SettingMutation) TypeCleared

func (m *SettingMutation) TypeCleared() bool

TypeCleared returns if the "type" field was cleared in this mutation.

func (*SettingMutation) UpdatedAt

func (m *SettingMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*SettingMutation) Value

func (m *SettingMutation) Value() (r string, exists bool)

Value returns the value of the "value" field in the mutation.

func (*SettingMutation) ValueCleared

func (m *SettingMutation) ValueCleared() bool

ValueCleared returns if the "value" field was cleared in this mutation.

func (*SettingMutation) Where

func (m *SettingMutation) Where(ps ...predicate.Setting)

Where appends a list predicates to the SettingMutation builder.

type SettingQuery

type SettingQuery struct {
	// contains filtered or unexported fields
}

SettingQuery is the builder for querying Setting entities.

func (*SettingQuery) All

func (sq *SettingQuery) All(ctx context.Context) ([]*Setting, error)

All executes the query and returns a list of Settings.

func (*SettingQuery) AllX

func (sq *SettingQuery) AllX(ctx context.Context) []*Setting

AllX is like All, but panics if an error occurs.

func (*SettingQuery) Clone

func (sq *SettingQuery) Clone() *SettingQuery

Clone returns a duplicate of the SettingQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*SettingQuery) Count

func (sq *SettingQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*SettingQuery) CountX

func (sq *SettingQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*SettingQuery) Exist

func (sq *SettingQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*SettingQuery) ExistX

func (sq *SettingQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*SettingQuery) Filter

func (sq *SettingQuery) Filter() *SettingFilter

Filter returns a Filter implementation to apply filters on the SettingQuery builder.

func (*SettingQuery) First

func (sq *SettingQuery) First(ctx context.Context) (*Setting, error)

First returns the first Setting entity from the query. Returns a *NotFoundError when no Setting was found.

func (*SettingQuery) FirstID

func (sq *SettingQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Setting ID from the query. Returns a *NotFoundError when no Setting ID was found.

func (*SettingQuery) FirstIDX

func (sq *SettingQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*SettingQuery) FirstX

func (sq *SettingQuery) FirstX(ctx context.Context) *Setting

FirstX is like First, but panics if an error occurs.

func (*SettingQuery) GroupBy

func (sq *SettingQuery) GroupBy(field string, fields ...string) *SettingGroupBy

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:"omitempty"`
	Count int `json:"count,omitempty"`
}

client.Setting.Query().
	GroupBy(setting.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SettingQuery) IDs

func (sq *SettingQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Setting IDs.

func (*SettingQuery) IDsX

func (sq *SettingQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*SettingQuery) Limit

func (sq *SettingQuery) Limit(limit int) *SettingQuery

Limit adds a limit step to the query.

func (*SettingQuery) Offset

func (sq *SettingQuery) Offset(offset int) *SettingQuery

Offset adds an offset step to the query.

func (*SettingQuery) Only

func (sq *SettingQuery) Only(ctx context.Context) (*Setting, error)

Only returns a single Setting entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Setting entity is found. Returns a *NotFoundError when no Setting entities are found.

func (*SettingQuery) OnlyID

func (sq *SettingQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Setting ID in the query. Returns a *NotSingularError when more than one Setting ID is found. Returns a *NotFoundError when no entities are found.

func (*SettingQuery) OnlyIDX

func (sq *SettingQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*SettingQuery) OnlyX

func (sq *SettingQuery) OnlyX(ctx context.Context) *Setting

OnlyX is like Only, but panics if an error occurs.

func (*SettingQuery) Order

func (sq *SettingQuery) Order(o ...OrderFunc) *SettingQuery

Order adds an order step to the query.

func (*SettingQuery) Select

func (sq *SettingQuery) Select(fields ...string) *SettingSelect

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:"omitempty"`
}

client.Setting.Query().
	Select(setting.FieldCreatedAt).
	Scan(ctx, &v)

func (*SettingQuery) Unique

func (sq *SettingQuery) Unique(unique bool) *SettingQuery

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 (*SettingQuery) Where

func (sq *SettingQuery) Where(ps ...predicate.Setting) *SettingQuery

Where adds a new predicate for the SettingQuery builder.

type SettingSelect

type SettingSelect struct {
	*SettingQuery
	// contains filtered or unexported fields
}

SettingSelect is the builder for selecting fields of Setting entities.

func (*SettingSelect) Bool

func (ss *SettingSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*SettingSelect) BoolX

func (ss *SettingSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*SettingSelect) Bools

func (ss *SettingSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*SettingSelect) BoolsX

func (ss *SettingSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*SettingSelect) Float64

func (ss *SettingSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*SettingSelect) Float64X

func (ss *SettingSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*SettingSelect) Float64s

func (ss *SettingSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*SettingSelect) Float64sX

func (ss *SettingSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*SettingSelect) Int

func (ss *SettingSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*SettingSelect) IntX

func (ss *SettingSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*SettingSelect) Ints

func (ss *SettingSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*SettingSelect) IntsX

func (ss *SettingSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*SettingSelect) Scan

func (ss *SettingSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*SettingSelect) ScanX

func (ss *SettingSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*SettingSelect) String

func (ss *SettingSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*SettingSelect) StringX

func (ss *SettingSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*SettingSelect) Strings

func (ss *SettingSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*SettingSelect) StringsX

func (ss *SettingSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type SettingUpdate

type SettingUpdate struct {
	// contains filtered or unexported fields
}

SettingUpdate is the builder for updating Setting entities.

func (*SettingUpdate) ClearDeletedAt

func (su *SettingUpdate) ClearDeletedAt() *SettingUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*SettingUpdate) ClearType

func (su *SettingUpdate) ClearType() *SettingUpdate

ClearType clears the value of the "type" field.

func (*SettingUpdate) ClearValue

func (su *SettingUpdate) ClearValue() *SettingUpdate

ClearValue clears the value of the "value" field.

func (*SettingUpdate) Exec

func (su *SettingUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SettingUpdate) ExecX

func (su *SettingUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SettingUpdate) Mutation

func (su *SettingUpdate) Mutation() *SettingMutation

Mutation returns the SettingMutation object of the builder.

func (*SettingUpdate) Save

func (su *SettingUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*SettingUpdate) SaveX

func (su *SettingUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*SettingUpdate) SetDeletedAt

func (su *SettingUpdate) SetDeletedAt(t time.Time) *SettingUpdate

SetDeletedAt sets the "deleted_at" field.

func (*SettingUpdate) SetName

func (su *SettingUpdate) SetName(s string) *SettingUpdate

SetName sets the "name" field.

func (*SettingUpdate) SetNillableDeletedAt

func (su *SettingUpdate) SetNillableDeletedAt(t *time.Time) *SettingUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*SettingUpdate) SetNillableType

func (su *SettingUpdate) SetNillableType(s *string) *SettingUpdate

SetNillableType sets the "type" field if the given value is not nil.

func (*SettingUpdate) SetNillableValue

func (su *SettingUpdate) SetNillableValue(s *string) *SettingUpdate

SetNillableValue sets the "value" field if the given value is not nil.

func (*SettingUpdate) SetType

func (su *SettingUpdate) SetType(s string) *SettingUpdate

SetType sets the "type" field.

func (*SettingUpdate) SetUpdatedAt

func (su *SettingUpdate) SetUpdatedAt(t time.Time) *SettingUpdate

SetUpdatedAt sets the "updated_at" field.

func (*SettingUpdate) SetValue

func (su *SettingUpdate) SetValue(s string) *SettingUpdate

SetValue sets the "value" field.

func (*SettingUpdate) Where

func (su *SettingUpdate) Where(ps ...predicate.Setting) *SettingUpdate

Where appends a list predicates to the SettingUpdate builder.

type SettingUpdateOne

type SettingUpdateOne struct {
	// contains filtered or unexported fields
}

SettingUpdateOne is the builder for updating a single Setting entity.

func (*SettingUpdateOne) ClearDeletedAt

func (suo *SettingUpdateOne) ClearDeletedAt() *SettingUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*SettingUpdateOne) ClearType

func (suo *SettingUpdateOne) ClearType() *SettingUpdateOne

ClearType clears the value of the "type" field.

func (*SettingUpdateOne) ClearValue

func (suo *SettingUpdateOne) ClearValue() *SettingUpdateOne

ClearValue clears the value of the "value" field.

func (*SettingUpdateOne) Exec

func (suo *SettingUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SettingUpdateOne) ExecX

func (suo *SettingUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SettingUpdateOne) Mutation

func (suo *SettingUpdateOne) Mutation() *SettingMutation

Mutation returns the SettingMutation object of the builder.

func (*SettingUpdateOne) Save

func (suo *SettingUpdateOne) Save(ctx context.Context) (*Setting, error)

Save executes the query and returns the updated Setting entity.

func (*SettingUpdateOne) SaveX

func (suo *SettingUpdateOne) SaveX(ctx context.Context) *Setting

SaveX is like Save, but panics if an error occurs.

func (*SettingUpdateOne) Select

func (suo *SettingUpdateOne) Select(field string, fields ...string) *SettingUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*SettingUpdateOne) SetDeletedAt

func (suo *SettingUpdateOne) SetDeletedAt(t time.Time) *SettingUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*SettingUpdateOne) SetName

func (suo *SettingUpdateOne) SetName(s string) *SettingUpdateOne

SetName sets the "name" field.

func (*SettingUpdateOne) SetNillableDeletedAt

func (suo *SettingUpdateOne) SetNillableDeletedAt(t *time.Time) *SettingUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*SettingUpdateOne) SetNillableType

func (suo *SettingUpdateOne) SetNillableType(s *string) *SettingUpdateOne

SetNillableType sets the "type" field if the given value is not nil.

func (*SettingUpdateOne) SetNillableValue

func (suo *SettingUpdateOne) SetNillableValue(s *string) *SettingUpdateOne

SetNillableValue sets the "value" field if the given value is not nil.

func (*SettingUpdateOne) SetType

func (suo *SettingUpdateOne) SetType(s string) *SettingUpdateOne

SetType sets the "type" field.

func (*SettingUpdateOne) SetUpdatedAt

func (suo *SettingUpdateOne) SetUpdatedAt(t time.Time) *SettingUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*SettingUpdateOne) SetValue

func (suo *SettingUpdateOne) SetValue(s string) *SettingUpdateOne

SetValue sets the "value" field.

type SettingUpsert

type SettingUpsert struct {
	*sql.UpdateSet
}

SettingUpsert is the "OnConflict" setter.

func (*SettingUpsert) ClearDeletedAt

func (u *SettingUpsert) ClearDeletedAt() *SettingUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*SettingUpsert) ClearType

func (u *SettingUpsert) ClearType() *SettingUpsert

ClearType clears the value of the "type" field.

func (*SettingUpsert) ClearValue

func (u *SettingUpsert) ClearValue() *SettingUpsert

ClearValue clears the value of the "value" field.

func (*SettingUpsert) SetCreatedAt

func (u *SettingUpsert) SetCreatedAt(v time.Time) *SettingUpsert

SetCreatedAt sets the "created_at" field.

func (*SettingUpsert) SetDeletedAt

func (u *SettingUpsert) SetDeletedAt(v time.Time) *SettingUpsert

SetDeletedAt sets the "deleted_at" field.

func (*SettingUpsert) SetName

func (u *SettingUpsert) SetName(v string) *SettingUpsert

SetName sets the "name" field.

func (*SettingUpsert) SetType

func (u *SettingUpsert) SetType(v string) *SettingUpsert

SetType sets the "type" field.

func (*SettingUpsert) SetUpdatedAt

func (u *SettingUpsert) SetUpdatedAt(v time.Time) *SettingUpsert

SetUpdatedAt sets the "updated_at" field.

func (*SettingUpsert) SetValue

func (u *SettingUpsert) SetValue(v string) *SettingUpsert

SetValue sets the "value" field.

func (*SettingUpsert) UpdateCreatedAt

func (u *SettingUpsert) UpdateCreatedAt() *SettingUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*SettingUpsert) UpdateDeletedAt

func (u *SettingUpsert) UpdateDeletedAt() *SettingUpsert

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*SettingUpsert) UpdateName

func (u *SettingUpsert) UpdateName() *SettingUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*SettingUpsert) UpdateType

func (u *SettingUpsert) UpdateType() *SettingUpsert

UpdateType sets the "type" field to the value that was provided on create.

func (*SettingUpsert) UpdateUpdatedAt

func (u *SettingUpsert) UpdateUpdatedAt() *SettingUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*SettingUpsert) UpdateValue

func (u *SettingUpsert) UpdateValue() *SettingUpsert

UpdateValue sets the "value" field to the value that was provided on create.

type SettingUpsertBulk

type SettingUpsertBulk struct {
	// contains filtered or unexported fields
}

SettingUpsertBulk is the builder for "upsert"-ing a bulk of Setting nodes.

func (*SettingUpsertBulk) ClearDeletedAt

func (u *SettingUpsertBulk) ClearDeletedAt() *SettingUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*SettingUpsertBulk) ClearType

func (u *SettingUpsertBulk) ClearType() *SettingUpsertBulk

ClearType clears the value of the "type" field.

func (*SettingUpsertBulk) ClearValue

func (u *SettingUpsertBulk) ClearValue() *SettingUpsertBulk

ClearValue clears the value of the "value" field.

func (*SettingUpsertBulk) DoNothing

func (u *SettingUpsertBulk) DoNothing() *SettingUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*SettingUpsertBulk) Exec

func (u *SettingUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*SettingUpsertBulk) ExecX

func (u *SettingUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SettingUpsertBulk) Ignore

func (u *SettingUpsertBulk) Ignore() *SettingUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Setting.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*SettingUpsertBulk) SetCreatedAt

func (u *SettingUpsertBulk) SetCreatedAt(v time.Time) *SettingUpsertBulk

SetCreatedAt sets the "created_at" field.

func (*SettingUpsertBulk) SetDeletedAt

func (u *SettingUpsertBulk) SetDeletedAt(v time.Time) *SettingUpsertBulk

SetDeletedAt sets the "deleted_at" field.

func (*SettingUpsertBulk) SetName

SetName sets the "name" field.

func (*SettingUpsertBulk) SetType

SetType sets the "type" field.

func (*SettingUpsertBulk) SetUpdatedAt

func (u *SettingUpsertBulk) SetUpdatedAt(v time.Time) *SettingUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*SettingUpsertBulk) SetValue

func (u *SettingUpsertBulk) SetValue(v string) *SettingUpsertBulk

SetValue sets the "value" field.

func (*SettingUpsertBulk) Update

func (u *SettingUpsertBulk) Update(set func(*SettingUpsert)) *SettingUpsertBulk

Update allows overriding fields `UPDATE` values. See the SettingCreateBulk.OnConflict documentation for more info.

func (*SettingUpsertBulk) UpdateCreatedAt

func (u *SettingUpsertBulk) UpdateCreatedAt() *SettingUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*SettingUpsertBulk) UpdateDeletedAt

func (u *SettingUpsertBulk) UpdateDeletedAt() *SettingUpsertBulk

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*SettingUpsertBulk) UpdateName

func (u *SettingUpsertBulk) UpdateName() *SettingUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*SettingUpsertBulk) UpdateNewValues

func (u *SettingUpsertBulk) UpdateNewValues() *SettingUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Setting.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*SettingUpsertBulk) UpdateType

func (u *SettingUpsertBulk) UpdateType() *SettingUpsertBulk

UpdateType sets the "type" field to the value that was provided on create.

func (*SettingUpsertBulk) UpdateUpdatedAt

func (u *SettingUpsertBulk) UpdateUpdatedAt() *SettingUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*SettingUpsertBulk) UpdateValue

func (u *SettingUpsertBulk) UpdateValue() *SettingUpsertBulk

UpdateValue sets the "value" field to the value that was provided on create.

type SettingUpsertOne

type SettingUpsertOne struct {
	// contains filtered or unexported fields
}

SettingUpsertOne is the builder for "upsert"-ing

one Setting node.

func (*SettingUpsertOne) ClearDeletedAt

func (u *SettingUpsertOne) ClearDeletedAt() *SettingUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*SettingUpsertOne) ClearType

func (u *SettingUpsertOne) ClearType() *SettingUpsertOne

ClearType clears the value of the "type" field.

func (*SettingUpsertOne) ClearValue

func (u *SettingUpsertOne) ClearValue() *SettingUpsertOne

ClearValue clears the value of the "value" field.

func (*SettingUpsertOne) DoNothing

func (u *SettingUpsertOne) DoNothing() *SettingUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*SettingUpsertOne) Exec

func (u *SettingUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*SettingUpsertOne) ExecX

func (u *SettingUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*SettingUpsertOne) ID

func (u *SettingUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*SettingUpsertOne) IDX

func (u *SettingUpsertOne) IDX(ctx context.Context) int

IDX is like ID, but panics if an error occurs.

func (*SettingUpsertOne) Ignore

func (u *SettingUpsertOne) Ignore() *SettingUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Setting.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*SettingUpsertOne) SetCreatedAt

func (u *SettingUpsertOne) SetCreatedAt(v time.Time) *SettingUpsertOne

SetCreatedAt sets the "created_at" field.

func (*SettingUpsertOne) SetDeletedAt

func (u *SettingUpsertOne) SetDeletedAt(v time.Time) *SettingUpsertOne

SetDeletedAt sets the "deleted_at" field.

func (*SettingUpsertOne) SetName

func (u *SettingUpsertOne) SetName(v string) *SettingUpsertOne

SetName sets the "name" field.

func (*SettingUpsertOne) SetType

func (u *SettingUpsertOne) SetType(v string) *SettingUpsertOne

SetType sets the "type" field.

func (*SettingUpsertOne) SetUpdatedAt

func (u *SettingUpsertOne) SetUpdatedAt(v time.Time) *SettingUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*SettingUpsertOne) SetValue

func (u *SettingUpsertOne) SetValue(v string) *SettingUpsertOne

SetValue sets the "value" field.

func (*SettingUpsertOne) Update

func (u *SettingUpsertOne) Update(set func(*SettingUpsert)) *SettingUpsertOne

Update allows overriding fields `UPDATE` values. See the SettingCreate.OnConflict documentation for more info.

func (*SettingUpsertOne) UpdateCreatedAt

func (u *SettingUpsertOne) UpdateCreatedAt() *SettingUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*SettingUpsertOne) UpdateDeletedAt

func (u *SettingUpsertOne) UpdateDeletedAt() *SettingUpsertOne

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*SettingUpsertOne) UpdateName

func (u *SettingUpsertOne) UpdateName() *SettingUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*SettingUpsertOne) UpdateNewValues

func (u *SettingUpsertOne) UpdateNewValues() *SettingUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Setting.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*SettingUpsertOne) UpdateType

func (u *SettingUpsertOne) UpdateType() *SettingUpsertOne

UpdateType sets the "type" field to the value that was provided on create.

func (*SettingUpsertOne) UpdateUpdatedAt

func (u *SettingUpsertOne) UpdateUpdatedAt() *SettingUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*SettingUpsertOne) UpdateValue

func (u *SettingUpsertOne) UpdateValue() *SettingUpsertOne

UpdateValue sets the "value" field to the value that was provided on create.

type Settings

type Settings []*Setting

Settings is a parsable slice of Setting.

type Topic

type Topic struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt time.Time `json:"omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty" validate:"max=255"`
	// Slug holds the value of the "slug" field.
	Slug string `json:"slug,omitempty" validate:"max=255"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty" validate:"max=255"`
	// Content holds the value of the "content" field.
	Content string `json:"content,omitempty" validate:"required"`
	// ContentHTML holds the value of the "content_html" field.
	ContentHTML string `json:"content_html,omitempty" validate:"required"`
	// ParentID holds the value of the "parent_id" field.
	ParentID int `json:"parent_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the TopicQuery when eager-loading is set.
	Edges TopicEdges `json:"edges"`
	// contains filtered or unexported fields
}

Topic is the model entity for the Topic schema.

func (*Topic) QueryChildren

func (t *Topic) QueryChildren() *TopicQuery

QueryChildren queries the "children" edge of the Topic entity.

func (*Topic) QueryParent

func (t *Topic) QueryParent() *TopicQuery

QueryParent queries the "parent" edge of the Topic entity.

func (*Topic) QueryPosts

func (t *Topic) QueryPosts() *PostQuery

QueryPosts queries the "posts" edge of the Topic entity.

func (*Topic) String

func (t *Topic) String() string

String implements the fmt.Stringer.

func (*Topic) Unwrap

func (t *Topic) Unwrap() *Topic

Unwrap unwraps the Topic 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 (*Topic) Update

func (t *Topic) Update() *TopicUpdateOne

Update returns a builder for updating this Topic. Note that you need to call Topic.Unwrap() before calling this method if this Topic was returned from a transaction, and the transaction was committed or rolled back.

type TopicClient

type TopicClient struct {
	// contains filtered or unexported fields
}

TopicClient is a client for the Topic schema.

func NewTopicClient

func NewTopicClient(c config) *TopicClient

NewTopicClient returns a client for the Topic from the given config.

func (*TopicClient) Create

func (c *TopicClient) Create() *TopicCreate

Create returns a create builder for Topic.

func (*TopicClient) CreateBulk

func (c *TopicClient) CreateBulk(builders ...*TopicCreate) *TopicCreateBulk

CreateBulk returns a builder for creating a bulk of Topic entities.

func (*TopicClient) Delete

func (c *TopicClient) Delete() *TopicDelete

Delete returns a delete builder for Topic.

func (*TopicClient) DeleteOne

func (c *TopicClient) DeleteOne(t *Topic) *TopicDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*TopicClient) DeleteOneID

func (c *TopicClient) DeleteOneID(id int) *TopicDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*TopicClient) Get

func (c *TopicClient) Get(ctx context.Context, id int) (*Topic, error)

Get returns a Topic entity by its id.

func (*TopicClient) GetX

func (c *TopicClient) GetX(ctx context.Context, id int) *Topic

GetX is like Get, but panics if an error occurs.

func (*TopicClient) Hooks

func (c *TopicClient) Hooks() []Hook

Hooks returns the client hooks.

func (*TopicClient) Query

func (c *TopicClient) Query() *TopicQuery

Query returns a query builder for Topic.

func (*TopicClient) QueryChildren

func (c *TopicClient) QueryChildren(t *Topic) *TopicQuery

QueryChildren queries the children edge of a Topic.

func (*TopicClient) QueryParent

func (c *TopicClient) QueryParent(t *Topic) *TopicQuery

QueryParent queries the parent edge of a Topic.

func (*TopicClient) QueryPosts

func (c *TopicClient) QueryPosts(t *Topic) *PostQuery

QueryPosts queries the posts edge of a Topic.

func (*TopicClient) Update

func (c *TopicClient) Update() *TopicUpdate

Update returns an update builder for Topic.

func (*TopicClient) UpdateOne

func (c *TopicClient) UpdateOne(t *Topic) *TopicUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TopicClient) UpdateOneID

func (c *TopicClient) UpdateOneID(id int) *TopicUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TopicClient) Use

func (c *TopicClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `topic.Hooks(f(g(h())))`.

type TopicCreate

type TopicCreate struct {
	// contains filtered or unexported fields
}

TopicCreate is the builder for creating a Topic entity.

func (*TopicCreate) AddChildIDs

func (tc *TopicCreate) AddChildIDs(ids ...int) *TopicCreate

AddChildIDs adds the "children" edge to the Topic entity by IDs.

func (*TopicCreate) AddChildren

func (tc *TopicCreate) AddChildren(t ...*Topic) *TopicCreate

AddChildren adds the "children" edges to the Topic entity.

func (*TopicCreate) AddPostIDs

func (tc *TopicCreate) AddPostIDs(ids ...int) *TopicCreate

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*TopicCreate) AddPosts

func (tc *TopicCreate) AddPosts(p ...*Post) *TopicCreate

AddPosts adds the "posts" edges to the Post entity.

func (*TopicCreate) Exec

func (tc *TopicCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TopicCreate) ExecX

func (tc *TopicCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TopicCreate) Mutation

func (tc *TopicCreate) Mutation() *TopicMutation

Mutation returns the TopicMutation object of the builder.

func (*TopicCreate) OnConflict

func (tc *TopicCreate) OnConflict(opts ...sql.ConflictOption) *TopicUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Topic.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.TopicUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*TopicCreate) OnConflictColumns

func (tc *TopicCreate) OnConflictColumns(columns ...string) *TopicUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Topic.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*TopicCreate) Save

func (tc *TopicCreate) Save(ctx context.Context) (*Topic, error)

Save creates the Topic in the database.

func (*TopicCreate) SaveX

func (tc *TopicCreate) SaveX(ctx context.Context) *Topic

SaveX calls Save and panics if Save returns an error.

func (*TopicCreate) SetContent

func (tc *TopicCreate) SetContent(s string) *TopicCreate

SetContent sets the "content" field.

func (*TopicCreate) SetContentHTML

func (tc *TopicCreate) SetContentHTML(s string) *TopicCreate

SetContentHTML sets the "content_html" field.

func (*TopicCreate) SetCreatedAt

func (tc *TopicCreate) SetCreatedAt(t time.Time) *TopicCreate

SetCreatedAt sets the "created_at" field.

func (*TopicCreate) SetDeletedAt

func (tc *TopicCreate) SetDeletedAt(t time.Time) *TopicCreate

SetDeletedAt sets the "deleted_at" field.

func (*TopicCreate) SetDescription

func (tc *TopicCreate) SetDescription(s string) *TopicCreate

SetDescription sets the "description" field.

func (*TopicCreate) SetName

func (tc *TopicCreate) SetName(s string) *TopicCreate

SetName sets the "name" field.

func (*TopicCreate) SetNillableCreatedAt

func (tc *TopicCreate) SetNillableCreatedAt(t *time.Time) *TopicCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*TopicCreate) SetNillableDeletedAt

func (tc *TopicCreate) SetNillableDeletedAt(t *time.Time) *TopicCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*TopicCreate) SetNillableDescription

func (tc *TopicCreate) SetNillableDescription(s *string) *TopicCreate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*TopicCreate) SetNillableParentID

func (tc *TopicCreate) SetNillableParentID(i *int) *TopicCreate

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*TopicCreate) SetNillableUpdatedAt

func (tc *TopicCreate) SetNillableUpdatedAt(t *time.Time) *TopicCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*TopicCreate) SetParent

func (tc *TopicCreate) SetParent(t *Topic) *TopicCreate

SetParent sets the "parent" edge to the Topic entity.

func (*TopicCreate) SetParentID

func (tc *TopicCreate) SetParentID(i int) *TopicCreate

SetParentID sets the "parent_id" field.

func (*TopicCreate) SetSlug

func (tc *TopicCreate) SetSlug(s string) *TopicCreate

SetSlug sets the "slug" field.

func (*TopicCreate) SetUpdatedAt

func (tc *TopicCreate) SetUpdatedAt(t time.Time) *TopicCreate

SetUpdatedAt sets the "updated_at" field.

type TopicCreateBulk

type TopicCreateBulk struct {
	// contains filtered or unexported fields
}

TopicCreateBulk is the builder for creating many Topic entities in bulk.

func (*TopicCreateBulk) Exec

func (tcb *TopicCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TopicCreateBulk) ExecX

func (tcb *TopicCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TopicCreateBulk) OnConflict

func (tcb *TopicCreateBulk) OnConflict(opts ...sql.ConflictOption) *TopicUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Topic.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.TopicUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*TopicCreateBulk) OnConflictColumns

func (tcb *TopicCreateBulk) OnConflictColumns(columns ...string) *TopicUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Topic.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*TopicCreateBulk) Save

func (tcb *TopicCreateBulk) Save(ctx context.Context) ([]*Topic, error)

Save creates the Topic entities in the database.

func (*TopicCreateBulk) SaveX

func (tcb *TopicCreateBulk) SaveX(ctx context.Context) []*Topic

SaveX is like Save, but panics if an error occurs.

type TopicDelete

type TopicDelete struct {
	// contains filtered or unexported fields
}

TopicDelete is the builder for deleting a Topic entity.

func (*TopicDelete) Exec

func (td *TopicDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*TopicDelete) ExecX

func (td *TopicDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*TopicDelete) Where

func (td *TopicDelete) Where(ps ...predicate.Topic) *TopicDelete

Where appends a list predicates to the TopicDelete builder.

type TopicDeleteOne

type TopicDeleteOne struct {
	// contains filtered or unexported fields
}

TopicDeleteOne is the builder for deleting a single Topic entity.

func (*TopicDeleteOne) Exec

func (tdo *TopicDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TopicDeleteOne) ExecX

func (tdo *TopicDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type TopicEdges

type TopicEdges struct {
	// Posts holds the value of the posts edge.
	Posts []*Post `json:"posts,omitempty"`
	// Children holds the value of the children edge.
	Children []*Topic `json:"children,omitempty"`
	// Parent holds the value of the parent edge.
	Parent *Topic `json:"parent,omitempty"`
	// contains filtered or unexported fields
}

TopicEdges holds the relations/edges for other nodes in the graph.

func (TopicEdges) ChildrenOrErr

func (e TopicEdges) ChildrenOrErr() ([]*Topic, error)

ChildrenOrErr returns the Children value or an error if the edge was not loaded in eager-loading.

func (TopicEdges) ParentOrErr

func (e TopicEdges) ParentOrErr() (*Topic, error)

ParentOrErr returns the Parent value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (TopicEdges) PostsOrErr

func (e TopicEdges) PostsOrErr() ([]*Post, error)

PostsOrErr returns the Posts value or an error if the edge was not loaded in eager-loading.

type TopicFilter

type TopicFilter struct {
	// contains filtered or unexported fields
}

TopicFilter provides a generic filtering capability at runtime for TopicQuery.

func (*TopicFilter) Where

func (f *TopicFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*TopicFilter) WhereContent

func (f *TopicFilter) WhereContent(p entql.StringP)

WhereContent applies the entql string predicate on the content field.

func (*TopicFilter) WhereContentHTML

func (f *TopicFilter) WhereContentHTML(p entql.StringP)

WhereContentHTML applies the entql string predicate on the content_html field.

func (*TopicFilter) WhereCreatedAt

func (f *TopicFilter) WhereCreatedAt(p entql.TimeP)

WhereCreatedAt applies the entql time.Time predicate on the created_at field.

func (*TopicFilter) WhereDeletedAt

func (f *TopicFilter) WhereDeletedAt(p entql.TimeP)

WhereDeletedAt applies the entql time.Time predicate on the deleted_at field.

func (*TopicFilter) WhereDescription

func (f *TopicFilter) WhereDescription(p entql.StringP)

WhereDescription applies the entql string predicate on the description field.

func (*TopicFilter) WhereHasChildren

func (f *TopicFilter) WhereHasChildren()

WhereHasChildren applies a predicate to check if query has an edge children.

func (*TopicFilter) WhereHasChildrenWith

func (f *TopicFilter) WhereHasChildrenWith(preds ...predicate.Topic)

WhereHasChildrenWith applies a predicate to check if query has an edge children with a given conditions (other predicates).

func (*TopicFilter) WhereHasParent

func (f *TopicFilter) WhereHasParent()

WhereHasParent applies a predicate to check if query has an edge parent.

func (*TopicFilter) WhereHasParentWith

func (f *TopicFilter) WhereHasParentWith(preds ...predicate.Topic)

WhereHasParentWith applies a predicate to check if query has an edge parent with a given conditions (other predicates).

func (*TopicFilter) WhereHasPosts

func (f *TopicFilter) WhereHasPosts()

WhereHasPosts applies a predicate to check if query has an edge posts.

func (*TopicFilter) WhereHasPostsWith

func (f *TopicFilter) WhereHasPostsWith(preds ...predicate.Post)

WhereHasPostsWith applies a predicate to check if query has an edge posts with a given conditions (other predicates).

func (*TopicFilter) WhereID

func (f *TopicFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*TopicFilter) WhereName

func (f *TopicFilter) WhereName(p entql.StringP)

WhereName applies the entql string predicate on the name field.

func (*TopicFilter) WhereParentID

func (f *TopicFilter) WhereParentID(p entql.IntP)

WhereParentID applies the entql int predicate on the parent_id field.

func (*TopicFilter) WhereSlug

func (f *TopicFilter) WhereSlug(p entql.StringP)

WhereSlug applies the entql string predicate on the slug field.

func (*TopicFilter) WhereUpdatedAt

func (f *TopicFilter) WhereUpdatedAt(p entql.TimeP)

WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.

type TopicGroupBy

type TopicGroupBy struct {
	// contains filtered or unexported fields
}

TopicGroupBy is the group-by builder for Topic entities.

func (*TopicGroupBy) Aggregate

func (tgb *TopicGroupBy) Aggregate(fns ...AggregateFunc) *TopicGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*TopicGroupBy) Bool

func (tgb *TopicGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*TopicGroupBy) BoolX

func (tgb *TopicGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TopicGroupBy) Bools

func (tgb *TopicGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*TopicGroupBy) BoolsX

func (tgb *TopicGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TopicGroupBy) Float64

func (tgb *TopicGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*TopicGroupBy) Float64X

func (tgb *TopicGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TopicGroupBy) Float64s

func (tgb *TopicGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*TopicGroupBy) Float64sX

func (tgb *TopicGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TopicGroupBy) Int

func (tgb *TopicGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*TopicGroupBy) IntX

func (tgb *TopicGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TopicGroupBy) Ints

func (tgb *TopicGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*TopicGroupBy) IntsX

func (tgb *TopicGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TopicGroupBy) Scan

func (tgb *TopicGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*TopicGroupBy) ScanX

func (tgb *TopicGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*TopicGroupBy) String

func (tgb *TopicGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*TopicGroupBy) StringX

func (tgb *TopicGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TopicGroupBy) Strings

func (tgb *TopicGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*TopicGroupBy) StringsX

func (tgb *TopicGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TopicMutation

type TopicMutation struct {
	// contains filtered or unexported fields
}

TopicMutation represents an operation that mutates the Topic nodes in the graph.

func (*TopicMutation) AddChildIDs

func (m *TopicMutation) AddChildIDs(ids ...int)

AddChildIDs adds the "children" edge to the Topic entity by ids.

func (*TopicMutation) AddField

func (m *TopicMutation) 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 (*TopicMutation) AddPostIDs

func (m *TopicMutation) AddPostIDs(ids ...int)

AddPostIDs adds the "posts" edge to the Post entity by ids.

func (*TopicMutation) AddedEdges

func (m *TopicMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*TopicMutation) AddedField

func (m *TopicMutation) 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 (*TopicMutation) AddedFields

func (m *TopicMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*TopicMutation) AddedIDs

func (m *TopicMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*TopicMutation) ChildrenCleared

func (m *TopicMutation) ChildrenCleared() bool

ChildrenCleared reports if the "children" edge to the Topic entity was cleared.

func (*TopicMutation) ChildrenIDs

func (m *TopicMutation) ChildrenIDs() (ids []int)

ChildrenIDs returns the "children" edge IDs in the mutation.

func (*TopicMutation) ClearChildren

func (m *TopicMutation) ClearChildren()

ClearChildren clears the "children" edge to the Topic entity.

func (*TopicMutation) ClearDeletedAt

func (m *TopicMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*TopicMutation) ClearDescription

func (m *TopicMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*TopicMutation) ClearEdge

func (m *TopicMutation) 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 (*TopicMutation) ClearField

func (m *TopicMutation) 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 (*TopicMutation) ClearParent

func (m *TopicMutation) ClearParent()

ClearParent clears the "parent" edge to the Topic entity.

func (*TopicMutation) ClearParentID

func (m *TopicMutation) ClearParentID()

ClearParentID clears the value of the "parent_id" field.

func (*TopicMutation) ClearPosts

func (m *TopicMutation) ClearPosts()

ClearPosts clears the "posts" edge to the Post entity.

func (*TopicMutation) ClearedEdges

func (m *TopicMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*TopicMutation) ClearedFields

func (m *TopicMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (TopicMutation) Client

func (m TopicMutation) 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 (*TopicMutation) Content

func (m *TopicMutation) Content() (r string, exists bool)

Content returns the value of the "content" field in the mutation.

func (*TopicMutation) ContentHTML

func (m *TopicMutation) ContentHTML() (r string, exists bool)

ContentHTML returns the value of the "content_html" field in the mutation.

func (*TopicMutation) CreatedAt

func (m *TopicMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*TopicMutation) DeletedAt

func (m *TopicMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*TopicMutation) DeletedAtCleared

func (m *TopicMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*TopicMutation) Description

func (m *TopicMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*TopicMutation) DescriptionCleared

func (m *TopicMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*TopicMutation) EdgeCleared

func (m *TopicMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*TopicMutation) Field

func (m *TopicMutation) 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 (*TopicMutation) FieldCleared

func (m *TopicMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*TopicMutation) Fields

func (m *TopicMutation) 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 (*TopicMutation) Filter

func (m *TopicMutation) Filter() *TopicFilter

Filter returns an entql.Where implementation to apply filters on the TopicMutation builder.

func (*TopicMutation) ID

func (m *TopicMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*TopicMutation) IDs

func (m *TopicMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*TopicMutation) Name

func (m *TopicMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*TopicMutation) OldContent

func (m *TopicMutation) OldContent(ctx context.Context) (v string, err error)

OldContent returns the old "content" field's value of the Topic entity. If the Topic 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 (*TopicMutation) OldContentHTML

func (m *TopicMutation) OldContentHTML(ctx context.Context) (v string, err error)

OldContentHTML returns the old "content_html" field's value of the Topic entity. If the Topic 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 (*TopicMutation) OldCreatedAt

func (m *TopicMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Topic entity. If the Topic 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 (*TopicMutation) OldDeletedAt

func (m *TopicMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the Topic entity. If the Topic 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 (*TopicMutation) OldDescription

func (m *TopicMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old "description" field's value of the Topic entity. If the Topic 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 (*TopicMutation) OldField

func (m *TopicMutation) 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 (*TopicMutation) OldName

func (m *TopicMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Topic entity. If the Topic 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 (*TopicMutation) OldParentID

func (m *TopicMutation) OldParentID(ctx context.Context) (v int, err error)

OldParentID returns the old "parent_id" field's value of the Topic entity. If the Topic 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 (*TopicMutation) OldSlug

func (m *TopicMutation) OldSlug(ctx context.Context) (v string, err error)

OldSlug returns the old "slug" field's value of the Topic entity. If the Topic 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 (*TopicMutation) OldUpdatedAt

func (m *TopicMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Topic entity. If the Topic 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 (*TopicMutation) Op

func (m *TopicMutation) Op() Op

Op returns the operation name.

func (*TopicMutation) ParentCleared

func (m *TopicMutation) ParentCleared() bool

ParentCleared reports if the "parent" edge to the Topic entity was cleared.

func (*TopicMutation) ParentID

func (m *TopicMutation) ParentID() (r int, exists bool)

ParentID returns the value of the "parent_id" field in the mutation.

func (*TopicMutation) ParentIDCleared

func (m *TopicMutation) ParentIDCleared() bool

ParentIDCleared returns if the "parent_id" field was cleared in this mutation.

func (*TopicMutation) ParentIDs

func (m *TopicMutation) ParentIDs() (ids []int)

ParentIDs returns the "parent" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use ParentID instead. It exists only for internal usage by the builders.

func (*TopicMutation) PostsCleared

func (m *TopicMutation) PostsCleared() bool

PostsCleared reports if the "posts" edge to the Post entity was cleared.

func (*TopicMutation) PostsIDs

func (m *TopicMutation) PostsIDs() (ids []int)

PostsIDs returns the "posts" edge IDs in the mutation.

func (*TopicMutation) RemoveChildIDs

func (m *TopicMutation) RemoveChildIDs(ids ...int)

RemoveChildIDs removes the "children" edge to the Topic entity by IDs.

func (*TopicMutation) RemovePostIDs

func (m *TopicMutation) RemovePostIDs(ids ...int)

RemovePostIDs removes the "posts" edge to the Post entity by IDs.

func (*TopicMutation) RemovedChildrenIDs

func (m *TopicMutation) RemovedChildrenIDs() (ids []int)

RemovedChildren returns the removed IDs of the "children" edge to the Topic entity.

func (*TopicMutation) RemovedEdges

func (m *TopicMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*TopicMutation) RemovedIDs

func (m *TopicMutation) 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 (*TopicMutation) RemovedPostsIDs

func (m *TopicMutation) RemovedPostsIDs() (ids []int)

RemovedPosts returns the removed IDs of the "posts" edge to the Post entity.

func (*TopicMutation) ResetChildren

func (m *TopicMutation) ResetChildren()

ResetChildren resets all changes to the "children" edge.

func (*TopicMutation) ResetContent

func (m *TopicMutation) ResetContent()

ResetContent resets all changes to the "content" field.

func (*TopicMutation) ResetContentHTML

func (m *TopicMutation) ResetContentHTML()

ResetContentHTML resets all changes to the "content_html" field.

func (*TopicMutation) ResetCreatedAt

func (m *TopicMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*TopicMutation) ResetDeletedAt

func (m *TopicMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*TopicMutation) ResetDescription

func (m *TopicMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*TopicMutation) ResetEdge

func (m *TopicMutation) 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 (*TopicMutation) ResetField

func (m *TopicMutation) 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 (*TopicMutation) ResetName

func (m *TopicMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*TopicMutation) ResetParent

func (m *TopicMutation) ResetParent()

ResetParent resets all changes to the "parent" edge.

func (*TopicMutation) ResetParentID

func (m *TopicMutation) ResetParentID()

ResetParentID resets all changes to the "parent_id" field.

func (*TopicMutation) ResetPosts

func (m *TopicMutation) ResetPosts()

ResetPosts resets all changes to the "posts" edge.

func (*TopicMutation) ResetSlug

func (m *TopicMutation) ResetSlug()

ResetSlug resets all changes to the "slug" field.

func (*TopicMutation) ResetUpdatedAt

func (m *TopicMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*TopicMutation) SetContent

func (m *TopicMutation) SetContent(s string)

SetContent sets the "content" field.

func (*TopicMutation) SetContentHTML

func (m *TopicMutation) SetContentHTML(s string)

SetContentHTML sets the "content_html" field.

func (*TopicMutation) SetCreatedAt

func (m *TopicMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*TopicMutation) SetDeletedAt

func (m *TopicMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*TopicMutation) SetDescription

func (m *TopicMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*TopicMutation) SetField

func (m *TopicMutation) 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 (*TopicMutation) SetName

func (m *TopicMutation) SetName(s string)

SetName sets the "name" field.

func (*TopicMutation) SetParentID

func (m *TopicMutation) SetParentID(i int)

SetParentID sets the "parent_id" field.

func (*TopicMutation) SetSlug

func (m *TopicMutation) SetSlug(s string)

SetSlug sets the "slug" field.

func (*TopicMutation) SetUpdatedAt

func (m *TopicMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*TopicMutation) Slug

func (m *TopicMutation) Slug() (r string, exists bool)

Slug returns the value of the "slug" field in the mutation.

func (TopicMutation) Tx

func (m TopicMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*TopicMutation) Type

func (m *TopicMutation) Type() string

Type returns the node type of this mutation (Topic).

func (*TopicMutation) UpdatedAt

func (m *TopicMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*TopicMutation) Where

func (m *TopicMutation) Where(ps ...predicate.Topic)

Where appends a list predicates to the TopicMutation builder.

type TopicQuery

type TopicQuery struct {
	// contains filtered or unexported fields
}

TopicQuery is the builder for querying Topic entities.

func (*TopicQuery) All

func (tq *TopicQuery) All(ctx context.Context) ([]*Topic, error)

All executes the query and returns a list of Topics.

func (*TopicQuery) AllX

func (tq *TopicQuery) AllX(ctx context.Context) []*Topic

AllX is like All, but panics if an error occurs.

func (*TopicQuery) Clone

func (tq *TopicQuery) Clone() *TopicQuery

Clone returns a duplicate of the TopicQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*TopicQuery) Count

func (tq *TopicQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TopicQuery) CountX

func (tq *TopicQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*TopicQuery) Exist

func (tq *TopicQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*TopicQuery) ExistX

func (tq *TopicQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*TopicQuery) Filter

func (tq *TopicQuery) Filter() *TopicFilter

Filter returns a Filter implementation to apply filters on the TopicQuery builder.

func (*TopicQuery) First

func (tq *TopicQuery) First(ctx context.Context) (*Topic, error)

First returns the first Topic entity from the query. Returns a *NotFoundError when no Topic was found.

func (*TopicQuery) FirstID

func (tq *TopicQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Topic ID from the query. Returns a *NotFoundError when no Topic ID was found.

func (*TopicQuery) FirstIDX

func (tq *TopicQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*TopicQuery) FirstX

func (tq *TopicQuery) FirstX(ctx context.Context) *Topic

FirstX is like First, but panics if an error occurs.

func (*TopicQuery) GroupBy

func (tq *TopicQuery) GroupBy(field string, fields ...string) *TopicGroupBy

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:"omitempty"`
	Count int `json:"count,omitempty"`
}

client.Topic.Query().
	GroupBy(topic.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TopicQuery) IDs

func (tq *TopicQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Topic IDs.

func (*TopicQuery) IDsX

func (tq *TopicQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*TopicQuery) Limit

func (tq *TopicQuery) Limit(limit int) *TopicQuery

Limit adds a limit step to the query.

func (*TopicQuery) Offset

func (tq *TopicQuery) Offset(offset int) *TopicQuery

Offset adds an offset step to the query.

func (*TopicQuery) Only

func (tq *TopicQuery) Only(ctx context.Context) (*Topic, error)

Only returns a single Topic entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Topic entity is found. Returns a *NotFoundError when no Topic entities are found.

func (*TopicQuery) OnlyID

func (tq *TopicQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Topic ID in the query. Returns a *NotSingularError when more than one Topic ID is found. Returns a *NotFoundError when no entities are found.

func (*TopicQuery) OnlyIDX

func (tq *TopicQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*TopicQuery) OnlyX

func (tq *TopicQuery) OnlyX(ctx context.Context) *Topic

OnlyX is like Only, but panics if an error occurs.

func (*TopicQuery) Order

func (tq *TopicQuery) Order(o ...OrderFunc) *TopicQuery

Order adds an order step to the query.

func (*TopicQuery) QueryChildren

func (tq *TopicQuery) QueryChildren() *TopicQuery

QueryChildren chains the current query on the "children" edge.

func (*TopicQuery) QueryParent

func (tq *TopicQuery) QueryParent() *TopicQuery

QueryParent chains the current query on the "parent" edge.

func (*TopicQuery) QueryPosts

func (tq *TopicQuery) QueryPosts() *PostQuery

QueryPosts chains the current query on the "posts" edge.

func (*TopicQuery) Select

func (tq *TopicQuery) Select(fields ...string) *TopicSelect

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:"omitempty"`
}

client.Topic.Query().
	Select(topic.FieldCreatedAt).
	Scan(ctx, &v)

func (*TopicQuery) Unique

func (tq *TopicQuery) Unique(unique bool) *TopicQuery

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 (*TopicQuery) Where

func (tq *TopicQuery) Where(ps ...predicate.Topic) *TopicQuery

Where adds a new predicate for the TopicQuery builder.

func (*TopicQuery) WithChildren

func (tq *TopicQuery) WithChildren(opts ...func(*TopicQuery)) *TopicQuery

WithChildren tells the query-builder to eager-load the nodes that are connected to the "children" edge. The optional arguments are used to configure the query builder of the edge.

func (*TopicQuery) WithParent

func (tq *TopicQuery) WithParent(opts ...func(*TopicQuery)) *TopicQuery

WithParent tells the query-builder to eager-load the nodes that are connected to the "parent" edge. The optional arguments are used to configure the query builder of the edge.

func (*TopicQuery) WithPosts

func (tq *TopicQuery) WithPosts(opts ...func(*PostQuery)) *TopicQuery

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 TopicSelect

type TopicSelect struct {
	*TopicQuery
	// contains filtered or unexported fields
}

TopicSelect is the builder for selecting fields of Topic entities.

func (*TopicSelect) Bool

func (ts *TopicSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*TopicSelect) BoolX

func (ts *TopicSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*TopicSelect) Bools

func (ts *TopicSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*TopicSelect) BoolsX

func (ts *TopicSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*TopicSelect) Float64

func (ts *TopicSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*TopicSelect) Float64X

func (ts *TopicSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*TopicSelect) Float64s

func (ts *TopicSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*TopicSelect) Float64sX

func (ts *TopicSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*TopicSelect) Int

func (ts *TopicSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*TopicSelect) IntX

func (ts *TopicSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*TopicSelect) Ints

func (ts *TopicSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*TopicSelect) IntsX

func (ts *TopicSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*TopicSelect) Scan

func (ts *TopicSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*TopicSelect) ScanX

func (ts *TopicSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*TopicSelect) String

func (ts *TopicSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*TopicSelect) StringX

func (ts *TopicSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*TopicSelect) Strings

func (ts *TopicSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*TopicSelect) StringsX

func (ts *TopicSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type TopicUpdate

type TopicUpdate struct {
	// contains filtered or unexported fields
}

TopicUpdate is the builder for updating Topic entities.

func (*TopicUpdate) AddChildIDs

func (tu *TopicUpdate) AddChildIDs(ids ...int) *TopicUpdate

AddChildIDs adds the "children" edge to the Topic entity by IDs.

func (*TopicUpdate) AddChildren

func (tu *TopicUpdate) AddChildren(t ...*Topic) *TopicUpdate

AddChildren adds the "children" edges to the Topic entity.

func (*TopicUpdate) AddPostIDs

func (tu *TopicUpdate) AddPostIDs(ids ...int) *TopicUpdate

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*TopicUpdate) AddPosts

func (tu *TopicUpdate) AddPosts(p ...*Post) *TopicUpdate

AddPosts adds the "posts" edges to the Post entity.

func (*TopicUpdate) ClearChildren

func (tu *TopicUpdate) ClearChildren() *TopicUpdate

ClearChildren clears all "children" edges to the Topic entity.

func (*TopicUpdate) ClearDeletedAt

func (tu *TopicUpdate) ClearDeletedAt() *TopicUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*TopicUpdate) ClearDescription

func (tu *TopicUpdate) ClearDescription() *TopicUpdate

ClearDescription clears the value of the "description" field.

func (*TopicUpdate) ClearParent

func (tu *TopicUpdate) ClearParent() *TopicUpdate

ClearParent clears the "parent" edge to the Topic entity.

func (*TopicUpdate) ClearParentID

func (tu *TopicUpdate) ClearParentID() *TopicUpdate

ClearParentID clears the value of the "parent_id" field.

func (*TopicUpdate) ClearPosts

func (tu *TopicUpdate) ClearPosts() *TopicUpdate

ClearPosts clears all "posts" edges to the Post entity.

func (*TopicUpdate) Exec

func (tu *TopicUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TopicUpdate) ExecX

func (tu *TopicUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TopicUpdate) Mutation

func (tu *TopicUpdate) Mutation() *TopicMutation

Mutation returns the TopicMutation object of the builder.

func (*TopicUpdate) RemoveChildIDs

func (tu *TopicUpdate) RemoveChildIDs(ids ...int) *TopicUpdate

RemoveChildIDs removes the "children" edge to Topic entities by IDs.

func (*TopicUpdate) RemoveChildren

func (tu *TopicUpdate) RemoveChildren(t ...*Topic) *TopicUpdate

RemoveChildren removes "children" edges to Topic entities.

func (*TopicUpdate) RemovePostIDs

func (tu *TopicUpdate) RemovePostIDs(ids ...int) *TopicUpdate

RemovePostIDs removes the "posts" edge to Post entities by IDs.

func (*TopicUpdate) RemovePosts

func (tu *TopicUpdate) RemovePosts(p ...*Post) *TopicUpdate

RemovePosts removes "posts" edges to Post entities.

func (*TopicUpdate) Save

func (tu *TopicUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*TopicUpdate) SaveX

func (tu *TopicUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*TopicUpdate) SetContent

func (tu *TopicUpdate) SetContent(s string) *TopicUpdate

SetContent sets the "content" field.

func (*TopicUpdate) SetContentHTML

func (tu *TopicUpdate) SetContentHTML(s string) *TopicUpdate

SetContentHTML sets the "content_html" field.

func (*TopicUpdate) SetDeletedAt

func (tu *TopicUpdate) SetDeletedAt(t time.Time) *TopicUpdate

SetDeletedAt sets the "deleted_at" field.

func (*TopicUpdate) SetDescription

func (tu *TopicUpdate) SetDescription(s string) *TopicUpdate

SetDescription sets the "description" field.

func (*TopicUpdate) SetName

func (tu *TopicUpdate) SetName(s string) *TopicUpdate

SetName sets the "name" field.

func (*TopicUpdate) SetNillableDeletedAt

func (tu *TopicUpdate) SetNillableDeletedAt(t *time.Time) *TopicUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*TopicUpdate) SetNillableDescription

func (tu *TopicUpdate) SetNillableDescription(s *string) *TopicUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*TopicUpdate) SetNillableParentID

func (tu *TopicUpdate) SetNillableParentID(i *int) *TopicUpdate

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*TopicUpdate) SetParent

func (tu *TopicUpdate) SetParent(t *Topic) *TopicUpdate

SetParent sets the "parent" edge to the Topic entity.

func (*TopicUpdate) SetParentID

func (tu *TopicUpdate) SetParentID(i int) *TopicUpdate

SetParentID sets the "parent_id" field.

func (*TopicUpdate) SetSlug

func (tu *TopicUpdate) SetSlug(s string) *TopicUpdate

SetSlug sets the "slug" field.

func (*TopicUpdate) SetUpdatedAt

func (tu *TopicUpdate) SetUpdatedAt(t time.Time) *TopicUpdate

SetUpdatedAt sets the "updated_at" field.

func (*TopicUpdate) Where

func (tu *TopicUpdate) Where(ps ...predicate.Topic) *TopicUpdate

Where appends a list predicates to the TopicUpdate builder.

type TopicUpdateOne

type TopicUpdateOne struct {
	// contains filtered or unexported fields
}

TopicUpdateOne is the builder for updating a single Topic entity.

func (*TopicUpdateOne) AddChildIDs

func (tuo *TopicUpdateOne) AddChildIDs(ids ...int) *TopicUpdateOne

AddChildIDs adds the "children" edge to the Topic entity by IDs.

func (*TopicUpdateOne) AddChildren

func (tuo *TopicUpdateOne) AddChildren(t ...*Topic) *TopicUpdateOne

AddChildren adds the "children" edges to the Topic entity.

func (*TopicUpdateOne) AddPostIDs

func (tuo *TopicUpdateOne) AddPostIDs(ids ...int) *TopicUpdateOne

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*TopicUpdateOne) AddPosts

func (tuo *TopicUpdateOne) AddPosts(p ...*Post) *TopicUpdateOne

AddPosts adds the "posts" edges to the Post entity.

func (*TopicUpdateOne) ClearChildren

func (tuo *TopicUpdateOne) ClearChildren() *TopicUpdateOne

ClearChildren clears all "children" edges to the Topic entity.

func (*TopicUpdateOne) ClearDeletedAt

func (tuo *TopicUpdateOne) ClearDeletedAt() *TopicUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*TopicUpdateOne) ClearDescription

func (tuo *TopicUpdateOne) ClearDescription() *TopicUpdateOne

ClearDescription clears the value of the "description" field.

func (*TopicUpdateOne) ClearParent

func (tuo *TopicUpdateOne) ClearParent() *TopicUpdateOne

ClearParent clears the "parent" edge to the Topic entity.

func (*TopicUpdateOne) ClearParentID

func (tuo *TopicUpdateOne) ClearParentID() *TopicUpdateOne

ClearParentID clears the value of the "parent_id" field.

func (*TopicUpdateOne) ClearPosts

func (tuo *TopicUpdateOne) ClearPosts() *TopicUpdateOne

ClearPosts clears all "posts" edges to the Post entity.

func (*TopicUpdateOne) Exec

func (tuo *TopicUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TopicUpdateOne) ExecX

func (tuo *TopicUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TopicUpdateOne) Mutation

func (tuo *TopicUpdateOne) Mutation() *TopicMutation

Mutation returns the TopicMutation object of the builder.

func (*TopicUpdateOne) RemoveChildIDs

func (tuo *TopicUpdateOne) RemoveChildIDs(ids ...int) *TopicUpdateOne

RemoveChildIDs removes the "children" edge to Topic entities by IDs.

func (*TopicUpdateOne) RemoveChildren

func (tuo *TopicUpdateOne) RemoveChildren(t ...*Topic) *TopicUpdateOne

RemoveChildren removes "children" edges to Topic entities.

func (*TopicUpdateOne) RemovePostIDs

func (tuo *TopicUpdateOne) RemovePostIDs(ids ...int) *TopicUpdateOne

RemovePostIDs removes the "posts" edge to Post entities by IDs.

func (*TopicUpdateOne) RemovePosts

func (tuo *TopicUpdateOne) RemovePosts(p ...*Post) *TopicUpdateOne

RemovePosts removes "posts" edges to Post entities.

func (*TopicUpdateOne) Save

func (tuo *TopicUpdateOne) Save(ctx context.Context) (*Topic, error)

Save executes the query and returns the updated Topic entity.

func (*TopicUpdateOne) SaveX

func (tuo *TopicUpdateOne) SaveX(ctx context.Context) *Topic

SaveX is like Save, but panics if an error occurs.

func (*TopicUpdateOne) Select

func (tuo *TopicUpdateOne) Select(field string, fields ...string) *TopicUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*TopicUpdateOne) SetContent

func (tuo *TopicUpdateOne) SetContent(s string) *TopicUpdateOne

SetContent sets the "content" field.

func (*TopicUpdateOne) SetContentHTML

func (tuo *TopicUpdateOne) SetContentHTML(s string) *TopicUpdateOne

SetContentHTML sets the "content_html" field.

func (*TopicUpdateOne) SetDeletedAt

func (tuo *TopicUpdateOne) SetDeletedAt(t time.Time) *TopicUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*TopicUpdateOne) SetDescription

func (tuo *TopicUpdateOne) SetDescription(s string) *TopicUpdateOne

SetDescription sets the "description" field.

func (*TopicUpdateOne) SetName

func (tuo *TopicUpdateOne) SetName(s string) *TopicUpdateOne

SetName sets the "name" field.

func (*TopicUpdateOne) SetNillableDeletedAt

func (tuo *TopicUpdateOne) SetNillableDeletedAt(t *time.Time) *TopicUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*TopicUpdateOne) SetNillableDescription

func (tuo *TopicUpdateOne) SetNillableDescription(s *string) *TopicUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*TopicUpdateOne) SetNillableParentID

func (tuo *TopicUpdateOne) SetNillableParentID(i *int) *TopicUpdateOne

SetNillableParentID sets the "parent_id" field if the given value is not nil.

func (*TopicUpdateOne) SetParent

func (tuo *TopicUpdateOne) SetParent(t *Topic) *TopicUpdateOne

SetParent sets the "parent" edge to the Topic entity.

func (*TopicUpdateOne) SetParentID

func (tuo *TopicUpdateOne) SetParentID(i int) *TopicUpdateOne

SetParentID sets the "parent_id" field.

func (*TopicUpdateOne) SetSlug

func (tuo *TopicUpdateOne) SetSlug(s string) *TopicUpdateOne

SetSlug sets the "slug" field.

func (*TopicUpdateOne) SetUpdatedAt

func (tuo *TopicUpdateOne) SetUpdatedAt(t time.Time) *TopicUpdateOne

SetUpdatedAt sets the "updated_at" field.

type TopicUpsert

type TopicUpsert struct {
	*sql.UpdateSet
}

TopicUpsert is the "OnConflict" setter.

func (*TopicUpsert) ClearDeletedAt

func (u *TopicUpsert) ClearDeletedAt() *TopicUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*TopicUpsert) ClearDescription

func (u *TopicUpsert) ClearDescription() *TopicUpsert

ClearDescription clears the value of the "description" field.

func (*TopicUpsert) ClearParentID

func (u *TopicUpsert) ClearParentID() *TopicUpsert

ClearParentID clears the value of the "parent_id" field.

func (*TopicUpsert) SetContent

func (u *TopicUpsert) SetContent(v string) *TopicUpsert

SetContent sets the "content" field.

func (*TopicUpsert) SetContentHTML

func (u *TopicUpsert) SetContentHTML(v string) *TopicUpsert

SetContentHTML sets the "content_html" field.

func (*TopicUpsert) SetCreatedAt

func (u *TopicUpsert) SetCreatedAt(v time.Time) *TopicUpsert

SetCreatedAt sets the "created_at" field.

func (*TopicUpsert) SetDeletedAt

func (u *TopicUpsert) SetDeletedAt(v time.Time) *TopicUpsert

SetDeletedAt sets the "deleted_at" field.

func (*TopicUpsert) SetDescription

func (u *TopicUpsert) SetDescription(v string) *TopicUpsert

SetDescription sets the "description" field.

func (*TopicUpsert) SetName

func (u *TopicUpsert) SetName(v string) *TopicUpsert

SetName sets the "name" field.

func (*TopicUpsert) SetParentID

func (u *TopicUpsert) SetParentID(v int) *TopicUpsert

SetParentID sets the "parent_id" field.

func (*TopicUpsert) SetSlug

func (u *TopicUpsert) SetSlug(v string) *TopicUpsert

SetSlug sets the "slug" field.

func (*TopicUpsert) SetUpdatedAt

func (u *TopicUpsert) SetUpdatedAt(v time.Time) *TopicUpsert

SetUpdatedAt sets the "updated_at" field.

func (*TopicUpsert) UpdateContent

func (u *TopicUpsert) UpdateContent() *TopicUpsert

UpdateContent sets the "content" field to the value that was provided on create.

func (*TopicUpsert) UpdateContentHTML

func (u *TopicUpsert) UpdateContentHTML() *TopicUpsert

UpdateContentHTML sets the "content_html" field to the value that was provided on create.

func (*TopicUpsert) UpdateCreatedAt

func (u *TopicUpsert) UpdateCreatedAt() *TopicUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*TopicUpsert) UpdateDeletedAt

func (u *TopicUpsert) UpdateDeletedAt() *TopicUpsert

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*TopicUpsert) UpdateDescription

func (u *TopicUpsert) UpdateDescription() *TopicUpsert

UpdateDescription sets the "description" field to the value that was provided on create.

func (*TopicUpsert) UpdateName

func (u *TopicUpsert) UpdateName() *TopicUpsert

UpdateName sets the "name" field to the value that was provided on create.

func (*TopicUpsert) UpdateParentID

func (u *TopicUpsert) UpdateParentID() *TopicUpsert

UpdateParentID sets the "parent_id" field to the value that was provided on create.

func (*TopicUpsert) UpdateSlug

func (u *TopicUpsert) UpdateSlug() *TopicUpsert

UpdateSlug sets the "slug" field to the value that was provided on create.

func (*TopicUpsert) UpdateUpdatedAt

func (u *TopicUpsert) UpdateUpdatedAt() *TopicUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type TopicUpsertBulk

type TopicUpsertBulk struct {
	// contains filtered or unexported fields
}

TopicUpsertBulk is the builder for "upsert"-ing a bulk of Topic nodes.

func (*TopicUpsertBulk) ClearDeletedAt

func (u *TopicUpsertBulk) ClearDeletedAt() *TopicUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*TopicUpsertBulk) ClearDescription

func (u *TopicUpsertBulk) ClearDescription() *TopicUpsertBulk

ClearDescription clears the value of the "description" field.

func (*TopicUpsertBulk) ClearParentID

func (u *TopicUpsertBulk) ClearParentID() *TopicUpsertBulk

ClearParentID clears the value of the "parent_id" field.

func (*TopicUpsertBulk) DoNothing

func (u *TopicUpsertBulk) DoNothing() *TopicUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*TopicUpsertBulk) Exec

func (u *TopicUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TopicUpsertBulk) ExecX

func (u *TopicUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TopicUpsertBulk) Ignore

func (u *TopicUpsertBulk) Ignore() *TopicUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Topic.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*TopicUpsertBulk) SetContent

func (u *TopicUpsertBulk) SetContent(v string) *TopicUpsertBulk

SetContent sets the "content" field.

func (*TopicUpsertBulk) SetContentHTML

func (u *TopicUpsertBulk) SetContentHTML(v string) *TopicUpsertBulk

SetContentHTML sets the "content_html" field.

func (*TopicUpsertBulk) SetCreatedAt

func (u *TopicUpsertBulk) SetCreatedAt(v time.Time) *TopicUpsertBulk

SetCreatedAt sets the "created_at" field.

func (*TopicUpsertBulk) SetDeletedAt

func (u *TopicUpsertBulk) SetDeletedAt(v time.Time) *TopicUpsertBulk

SetDeletedAt sets the "deleted_at" field.

func (*TopicUpsertBulk) SetDescription

func (u *TopicUpsertBulk) SetDescription(v string) *TopicUpsertBulk

SetDescription sets the "description" field.

func (*TopicUpsertBulk) SetName

func (u *TopicUpsertBulk) SetName(v string) *TopicUpsertBulk

SetName sets the "name" field.

func (*TopicUpsertBulk) SetParentID

func (u *TopicUpsertBulk) SetParentID(v int) *TopicUpsertBulk

SetParentID sets the "parent_id" field.

func (*TopicUpsertBulk) SetSlug

func (u *TopicUpsertBulk) SetSlug(v string) *TopicUpsertBulk

SetSlug sets the "slug" field.

func (*TopicUpsertBulk) SetUpdatedAt

func (u *TopicUpsertBulk) SetUpdatedAt(v time.Time) *TopicUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*TopicUpsertBulk) Update

func (u *TopicUpsertBulk) Update(set func(*TopicUpsert)) *TopicUpsertBulk

Update allows overriding fields `UPDATE` values. See the TopicCreateBulk.OnConflict documentation for more info.

func (*TopicUpsertBulk) UpdateContent

func (u *TopicUpsertBulk) UpdateContent() *TopicUpsertBulk

UpdateContent sets the "content" field to the value that was provided on create.

func (*TopicUpsertBulk) UpdateContentHTML

func (u *TopicUpsertBulk) UpdateContentHTML() *TopicUpsertBulk

UpdateContentHTML sets the "content_html" field to the value that was provided on create.

func (*TopicUpsertBulk) UpdateCreatedAt

func (u *TopicUpsertBulk) UpdateCreatedAt() *TopicUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*TopicUpsertBulk) UpdateDeletedAt

func (u *TopicUpsertBulk) UpdateDeletedAt() *TopicUpsertBulk

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*TopicUpsertBulk) UpdateDescription

func (u *TopicUpsertBulk) UpdateDescription() *TopicUpsertBulk

UpdateDescription sets the "description" field to the value that was provided on create.

func (*TopicUpsertBulk) UpdateName

func (u *TopicUpsertBulk) UpdateName() *TopicUpsertBulk

UpdateName sets the "name" field to the value that was provided on create.

func (*TopicUpsertBulk) UpdateNewValues

func (u *TopicUpsertBulk) UpdateNewValues() *TopicUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Topic.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*TopicUpsertBulk) UpdateParentID

func (u *TopicUpsertBulk) UpdateParentID() *TopicUpsertBulk

UpdateParentID sets the "parent_id" field to the value that was provided on create.

func (*TopicUpsertBulk) UpdateSlug

func (u *TopicUpsertBulk) UpdateSlug() *TopicUpsertBulk

UpdateSlug sets the "slug" field to the value that was provided on create.

func (*TopicUpsertBulk) UpdateUpdatedAt

func (u *TopicUpsertBulk) UpdateUpdatedAt() *TopicUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type TopicUpsertOne

type TopicUpsertOne struct {
	// contains filtered or unexported fields
}

TopicUpsertOne is the builder for "upsert"-ing

one Topic node.

func (*TopicUpsertOne) ClearDeletedAt

func (u *TopicUpsertOne) ClearDeletedAt() *TopicUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*TopicUpsertOne) ClearDescription

func (u *TopicUpsertOne) ClearDescription() *TopicUpsertOne

ClearDescription clears the value of the "description" field.

func (*TopicUpsertOne) ClearParentID

func (u *TopicUpsertOne) ClearParentID() *TopicUpsertOne

ClearParentID clears the value of the "parent_id" field.

func (*TopicUpsertOne) DoNothing

func (u *TopicUpsertOne) DoNothing() *TopicUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*TopicUpsertOne) Exec

func (u *TopicUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*TopicUpsertOne) ExecX

func (u *TopicUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*TopicUpsertOne) ID

func (u *TopicUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*TopicUpsertOne) IDX

func (u *TopicUpsertOne) IDX(ctx context.Context) int

IDX is like ID, but panics if an error occurs.

func (*TopicUpsertOne) Ignore

func (u *TopicUpsertOne) Ignore() *TopicUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Topic.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*TopicUpsertOne) SetContent

func (u *TopicUpsertOne) SetContent(v string) *TopicUpsertOne

SetContent sets the "content" field.

func (*TopicUpsertOne) SetContentHTML

func (u *TopicUpsertOne) SetContentHTML(v string) *TopicUpsertOne

SetContentHTML sets the "content_html" field.

func (*TopicUpsertOne) SetCreatedAt

func (u *TopicUpsertOne) SetCreatedAt(v time.Time) *TopicUpsertOne

SetCreatedAt sets the "created_at" field.

func (*TopicUpsertOne) SetDeletedAt

func (u *TopicUpsertOne) SetDeletedAt(v time.Time) *TopicUpsertOne

SetDeletedAt sets the "deleted_at" field.

func (*TopicUpsertOne) SetDescription

func (u *TopicUpsertOne) SetDescription(v string) *TopicUpsertOne

SetDescription sets the "description" field.

func (*TopicUpsertOne) SetName

func (u *TopicUpsertOne) SetName(v string) *TopicUpsertOne

SetName sets the "name" field.

func (*TopicUpsertOne) SetParentID

func (u *TopicUpsertOne) SetParentID(v int) *TopicUpsertOne

SetParentID sets the "parent_id" field.

func (*TopicUpsertOne) SetSlug

func (u *TopicUpsertOne) SetSlug(v string) *TopicUpsertOne

SetSlug sets the "slug" field.

func (*TopicUpsertOne) SetUpdatedAt

func (u *TopicUpsertOne) SetUpdatedAt(v time.Time) *TopicUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*TopicUpsertOne) Update

func (u *TopicUpsertOne) Update(set func(*TopicUpsert)) *TopicUpsertOne

Update allows overriding fields `UPDATE` values. See the TopicCreate.OnConflict documentation for more info.

func (*TopicUpsertOne) UpdateContent

func (u *TopicUpsertOne) UpdateContent() *TopicUpsertOne

UpdateContent sets the "content" field to the value that was provided on create.

func (*TopicUpsertOne) UpdateContentHTML

func (u *TopicUpsertOne) UpdateContentHTML() *TopicUpsertOne

UpdateContentHTML sets the "content_html" field to the value that was provided on create.

func (*TopicUpsertOne) UpdateCreatedAt

func (u *TopicUpsertOne) UpdateCreatedAt() *TopicUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*TopicUpsertOne) UpdateDeletedAt

func (u *TopicUpsertOne) UpdateDeletedAt() *TopicUpsertOne

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*TopicUpsertOne) UpdateDescription

func (u *TopicUpsertOne) UpdateDescription() *TopicUpsertOne

UpdateDescription sets the "description" field to the value that was provided on create.

func (*TopicUpsertOne) UpdateName

func (u *TopicUpsertOne) UpdateName() *TopicUpsertOne

UpdateName sets the "name" field to the value that was provided on create.

func (*TopicUpsertOne) UpdateNewValues

func (u *TopicUpsertOne) UpdateNewValues() *TopicUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Topic.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*TopicUpsertOne) UpdateParentID

func (u *TopicUpsertOne) UpdateParentID() *TopicUpsertOne

UpdateParentID sets the "parent_id" field to the value that was provided on create.

func (*TopicUpsertOne) UpdateSlug

func (u *TopicUpsertOne) UpdateSlug() *TopicUpsertOne

UpdateSlug sets the "slug" field to the value that was provided on create.

func (*TopicUpsertOne) UpdateUpdatedAt

func (u *TopicUpsertOne) UpdateUpdatedAt() *TopicUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type Topics

type Topics []*Topic

Topics is a parsable slice of Topic.

type Tx

type Tx struct {

	// Comment is the client for interacting with the Comment builders.
	Comment *CommentClient
	// File is the client for interacting with the File builders.
	File *FileClient
	// Page is the client for interacting with the Page builders.
	Page *PageClient
	// Permission is the client for interacting with the Permission builders.
	Permission *PermissionClient
	// Post is the client for interacting with the Post builders.
	Post *PostClient
	// Role is the client for interacting with the Role builders.
	Role *RoleClient
	// Setting is the client for interacting with the Setting builders.
	Setting *SettingClient
	// Topic is the client for interacting with the Topic builders.
	Topic *TopicClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"omitempty"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt time.Time `json:"omitempty"`
	// Username holds the value of the "username" field.
	Username string `json:"username,omitempty"`
	// DisplayName holds the value of the "display_name" field.
	DisplayName string `json:"display_name,omitempty"`
	// URL holds the value of the "url" field.
	URL string `json:"url,omitempty"`
	// Provider holds the value of the "provider" field.
	Provider string `json:"provider,omitempty"`
	// ProviderID holds the value of the "provider_id" field.
	ProviderID string `json:"provider_id,omitempty"`
	// ProviderUsername holds the value of the "provider_username" field.
	ProviderUsername string `json:"provider_username,omitempty"`
	// ProviderAvatar holds the value of the "provider_avatar" field.
	ProviderAvatar string `json:"provider_avatar,omitempty"`
	// Email holds the value of the "email" field.
	Email string `json:"email,omitempty"`
	// Password holds the value of the "password" field.
	Password string `json:"password,omitempty"`
	// Bio holds the value of the "bio" field.
	Bio string `json:"bio,omitempty"`
	// BioHTML holds the value of the "bio_html" field.
	BioHTML string `json:"bio_html,omitempty"`
	// Active holds the value of the "active" field.
	Active bool `json:"active,omitempty"`
	// AvatarImageID holds the value of the "avatar_image_id" field.
	AvatarImageID int `json:"avatar_image_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryAvatarImage

func (u *User) QueryAvatarImage() *FileQuery

QueryAvatarImage queries the "avatar_image" edge of the User entity.

func (*User) QueryComments

func (u *User) QueryComments() *CommentQuery

QueryComments queries the "comments" edge of the User entity.

func (*User) QueryFiles

func (u *User) QueryFiles() *FileQuery

QueryFiles queries the "files" edge of the User entity.

func (*User) QueryPosts

func (u *User) QueryPosts() *PostQuery

QueryPosts queries the "posts" edge of the User entity.

func (*User) QueryRoles

func (u *User) QueryRoles() *RoleQuery

QueryRoles queries the "roles" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*User) Update

func (u *User) Update() *UserUpdateOne

Update returns a builder for updating this User. Note that you need to call User.Unwrap() before calling this method if this User was returned from a transaction, and the transaction was committed or rolled back.

type UserClient

type UserClient struct {
	// contains filtered or unexported fields
}

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a create builder for User.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

CreateBulk returns a builder for creating a bulk of User entities.

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int) *User

GetX is like Get, but panics if an error occurs.

func (*UserClient) Hooks

func (c *UserClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryAvatarImage

func (c *UserClient) QueryAvatarImage(u *User) *FileQuery

QueryAvatarImage queries the avatar_image edge of a User.

func (*UserClient) QueryComments

func (c *UserClient) QueryComments(u *User) *CommentQuery

QueryComments queries the comments edge of a User.

func (*UserClient) QueryFiles

func (c *UserClient) QueryFiles(u *User) *FileQuery

QueryFiles queries the files edge of a User.

func (*UserClient) QueryPosts

func (c *UserClient) QueryPosts(u *User) *PostQuery

QueryPosts queries the posts edge of a User.

func (*UserClient) QueryRoles

func (c *UserClient) QueryRoles(u *User) *RoleQuery

QueryRoles queries the roles edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id int) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

func (c *UserClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.

type UserCreate

type UserCreate struct {
	// contains filtered or unexported fields
}

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddCommentIDs

func (uc *UserCreate) AddCommentIDs(ids ...int) *UserCreate

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*UserCreate) AddComments

func (uc *UserCreate) AddComments(c ...*Comment) *UserCreate

AddComments adds the "comments" edges to the Comment entity.

func (*UserCreate) AddFileIDs

func (uc *UserCreate) AddFileIDs(ids ...int) *UserCreate

AddFileIDs adds the "files" edge to the File entity by IDs.

func (*UserCreate) AddFiles

func (uc *UserCreate) AddFiles(f ...*File) *UserCreate

AddFiles adds the "files" edges to the File entity.

func (*UserCreate) AddPostIDs

func (uc *UserCreate) AddPostIDs(ids ...int) *UserCreate

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*UserCreate) AddPosts

func (uc *UserCreate) AddPosts(p ...*Post) *UserCreate

AddPosts adds the "posts" edges to the Post entity.

func (*UserCreate) AddRoleIDs

func (uc *UserCreate) AddRoleIDs(ids ...int) *UserCreate

AddRoleIDs adds the "roles" edge to the Role entity by IDs.

func (*UserCreate) AddRoles

func (uc *UserCreate) AddRoles(r ...*Role) *UserCreate

AddRoles adds the "roles" edges to the Role entity.

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) OnConflict

func (uc *UserCreate) OnConflict(opts ...sql.ConflictOption) *UserUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.User.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.UserUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*UserCreate) OnConflictColumns

func (uc *UserCreate) OnConflictColumns(columns ...string) *UserUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.User.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetActive

func (uc *UserCreate) SetActive(b bool) *UserCreate

SetActive sets the "active" field.

func (*UserCreate) SetAvatarImage

func (uc *UserCreate) SetAvatarImage(f *File) *UserCreate

SetAvatarImage sets the "avatar_image" edge to the File entity.

func (*UserCreate) SetAvatarImageID

func (uc *UserCreate) SetAvatarImageID(i int) *UserCreate

SetAvatarImageID sets the "avatar_image_id" field.

func (*UserCreate) SetBio

func (uc *UserCreate) SetBio(s string) *UserCreate

SetBio sets the "bio" field.

func (*UserCreate) SetBioHTML

func (uc *UserCreate) SetBioHTML(s string) *UserCreate

SetBioHTML sets the "bio_html" field.

func (*UserCreate) SetCreatedAt

func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetDeletedAt

func (uc *UserCreate) SetDeletedAt(t time.Time) *UserCreate

SetDeletedAt sets the "deleted_at" field.

func (*UserCreate) SetDisplayName

func (uc *UserCreate) SetDisplayName(s string) *UserCreate

SetDisplayName sets the "display_name" field.

func (*UserCreate) SetEmail

func (uc *UserCreate) SetEmail(s string) *UserCreate

SetEmail sets the "email" field.

func (*UserCreate) SetNillableActive

func (uc *UserCreate) SetNillableActive(b *bool) *UserCreate

SetNillableActive sets the "active" field if the given value is not nil.

func (*UserCreate) SetNillableAvatarImageID

func (uc *UserCreate) SetNillableAvatarImageID(i *int) *UserCreate

SetNillableAvatarImageID sets the "avatar_image_id" field if the given value is not nil.

func (*UserCreate) SetNillableBio

func (uc *UserCreate) SetNillableBio(s *string) *UserCreate

SetNillableBio sets the "bio" field if the given value is not nil.

func (*UserCreate) SetNillableBioHTML

func (uc *UserCreate) SetNillableBioHTML(s *string) *UserCreate

SetNillableBioHTML sets the "bio_html" field if the given value is not nil.

func (*UserCreate) SetNillableCreatedAt

func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserCreate) SetNillableDeletedAt

func (uc *UserCreate) SetNillableDeletedAt(t *time.Time) *UserCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*UserCreate) SetNillableDisplayName

func (uc *UserCreate) SetNillableDisplayName(s *string) *UserCreate

SetNillableDisplayName sets the "display_name" field if the given value is not nil.

func (*UserCreate) SetNillableEmail

func (uc *UserCreate) SetNillableEmail(s *string) *UserCreate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserCreate) SetNillablePassword

func (uc *UserCreate) SetNillablePassword(s *string) *UserCreate

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UserCreate) SetNillableProvider

func (uc *UserCreate) SetNillableProvider(s *string) *UserCreate

SetNillableProvider sets the "provider" field if the given value is not nil.

func (*UserCreate) SetNillableProviderAvatar

func (uc *UserCreate) SetNillableProviderAvatar(s *string) *UserCreate

SetNillableProviderAvatar sets the "provider_avatar" field if the given value is not nil.

func (*UserCreate) SetNillableProviderID

func (uc *UserCreate) SetNillableProviderID(s *string) *UserCreate

SetNillableProviderID sets the "provider_id" field if the given value is not nil.

func (*UserCreate) SetNillableProviderUsername

func (uc *UserCreate) SetNillableProviderUsername(s *string) *UserCreate

SetNillableProviderUsername sets the "provider_username" field if the given value is not nil.

func (*UserCreate) SetNillableURL

func (uc *UserCreate) SetNillableURL(s *string) *UserCreate

SetNillableURL sets the "url" field if the given value is not nil.

func (*UserCreate) SetNillableUpdatedAt

func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*UserCreate) SetPassword

func (uc *UserCreate) SetPassword(s string) *UserCreate

SetPassword sets the "password" field.

func (*UserCreate) SetProvider

func (uc *UserCreate) SetProvider(s string) *UserCreate

SetProvider sets the "provider" field.

func (*UserCreate) SetProviderAvatar

func (uc *UserCreate) SetProviderAvatar(s string) *UserCreate

SetProviderAvatar sets the "provider_avatar" field.

func (*UserCreate) SetProviderID

func (uc *UserCreate) SetProviderID(s string) *UserCreate

SetProviderID sets the "provider_id" field.

func (*UserCreate) SetProviderUsername

func (uc *UserCreate) SetProviderUsername(s string) *UserCreate

SetProviderUsername sets the "provider_username" field.

func (*UserCreate) SetURL

func (uc *UserCreate) SetURL(s string) *UserCreate

SetURL sets the "url" field.

func (*UserCreate) SetUpdatedAt

func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate

SetUpdatedAt sets the "updated_at" field.

func (*UserCreate) SetUsername

func (uc *UserCreate) SetUsername(s string) *UserCreate

SetUsername sets the "username" field.

type UserCreateBulk

type UserCreateBulk struct {
	// contains filtered or unexported fields
}

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreateBulk) OnConflict

func (ucb *UserCreateBulk) OnConflict(opts ...sql.ConflictOption) *UserUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.User.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.UserUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*UserCreateBulk) OnConflictColumns

func (ucb *UserCreateBulk) OnConflictColumns(columns ...string) *UserUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.User.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

SaveX is like Save, but panics if an error occurs.

type UserDelete

type UserDelete struct {
	// contains filtered or unexported fields
}

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

type UserDeleteOne struct {
	// contains filtered or unexported fields
}

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type UserEdges

type UserEdges struct {
	// Posts holds the value of the posts edge.
	Posts []*Post `json:"posts,omitempty"`
	// Files holds the value of the files edge.
	Files []*File `json:"files,omitempty"`
	// Comments holds the value of the comments edge.
	Comments []*Comment `json:"comments,omitempty"`
	// Roles holds the value of the roles edge.
	Roles []*Role `json:"roles,omitempty"`
	// AvatarImage holds the value of the avatar_image edge.
	AvatarImage *File `json:"avatar_image,omitempty"`
	// contains filtered or unexported fields
}

UserEdges holds the relations/edges for other nodes in the graph.

func (UserEdges) AvatarImageOrErr

func (e UserEdges) AvatarImageOrErr() (*File, error)

AvatarImageOrErr returns the AvatarImage value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

func (UserEdges) CommentsOrErr

func (e UserEdges) CommentsOrErr() ([]*Comment, error)

CommentsOrErr returns the Comments value or an error if the edge was not loaded in eager-loading.

func (UserEdges) FilesOrErr

func (e UserEdges) FilesOrErr() ([]*File, error)

FilesOrErr returns the Files value or an error if the edge was not loaded in eager-loading.

func (UserEdges) PostsOrErr

func (e UserEdges) PostsOrErr() ([]*Post, error)

PostsOrErr returns the Posts value or an error if the edge was not loaded in eager-loading.

func (UserEdges) RolesOrErr

func (e UserEdges) RolesOrErr() ([]*Role, error)

RolesOrErr returns the Roles value or an error if the edge was not loaded in eager-loading.

type UserFilter

type UserFilter struct {
	// contains filtered or unexported fields
}

UserFilter provides a generic filtering capability at runtime for UserQuery.

func (*UserFilter) Where

func (f *UserFilter) Where(p entql.P)

Where applies the entql predicate on the query filter.

func (*UserFilter) WhereActive

func (f *UserFilter) WhereActive(p entql.BoolP)

WhereActive applies the entql bool predicate on the active field.

func (*UserFilter) WhereAvatarImageID

func (f *UserFilter) WhereAvatarImageID(p entql.IntP)

WhereAvatarImageID applies the entql int predicate on the avatar_image_id field.

func (*UserFilter) WhereBio

func (f *UserFilter) WhereBio(p entql.StringP)

WhereBio applies the entql string predicate on the bio field.

func (*UserFilter) WhereBioHTML

func (f *UserFilter) WhereBioHTML(p entql.StringP)

WhereBioHTML applies the entql string predicate on the bio_html field.

func (*UserFilter) WhereCreatedAt

func (f *UserFilter) WhereCreatedAt(p entql.TimeP)

WhereCreatedAt applies the entql time.Time predicate on the created_at field.

func (*UserFilter) WhereDeletedAt

func (f *UserFilter) WhereDeletedAt(p entql.TimeP)

WhereDeletedAt applies the entql time.Time predicate on the deleted_at field.

func (*UserFilter) WhereDisplayName

func (f *UserFilter) WhereDisplayName(p entql.StringP)

WhereDisplayName applies the entql string predicate on the display_name field.

func (*UserFilter) WhereEmail

func (f *UserFilter) WhereEmail(p entql.StringP)

WhereEmail applies the entql string predicate on the email field.

func (*UserFilter) WhereHasAvatarImage

func (f *UserFilter) WhereHasAvatarImage()

WhereHasAvatarImage applies a predicate to check if query has an edge avatar_image.

func (*UserFilter) WhereHasAvatarImageWith

func (f *UserFilter) WhereHasAvatarImageWith(preds ...predicate.File)

WhereHasAvatarImageWith applies a predicate to check if query has an edge avatar_image with a given conditions (other predicates).

func (*UserFilter) WhereHasComments

func (f *UserFilter) WhereHasComments()

WhereHasComments applies a predicate to check if query has an edge comments.

func (*UserFilter) WhereHasCommentsWith

func (f *UserFilter) WhereHasCommentsWith(preds ...predicate.Comment)

WhereHasCommentsWith applies a predicate to check if query has an edge comments with a given conditions (other predicates).

func (*UserFilter) WhereHasFiles

func (f *UserFilter) WhereHasFiles()

WhereHasFiles applies a predicate to check if query has an edge files.

func (*UserFilter) WhereHasFilesWith

func (f *UserFilter) WhereHasFilesWith(preds ...predicate.File)

WhereHasFilesWith applies a predicate to check if query has an edge files with a given conditions (other predicates).

func (*UserFilter) WhereHasPosts

func (f *UserFilter) WhereHasPosts()

WhereHasPosts applies a predicate to check if query has an edge posts.

func (*UserFilter) WhereHasPostsWith

func (f *UserFilter) WhereHasPostsWith(preds ...predicate.Post)

WhereHasPostsWith applies a predicate to check if query has an edge posts with a given conditions (other predicates).

func (*UserFilter) WhereHasRoles

func (f *UserFilter) WhereHasRoles()

WhereHasRoles applies a predicate to check if query has an edge roles.

func (*UserFilter) WhereHasRolesWith

func (f *UserFilter) WhereHasRolesWith(preds ...predicate.Role)

WhereHasRolesWith applies a predicate to check if query has an edge roles with a given conditions (other predicates).

func (*UserFilter) WhereID

func (f *UserFilter) WhereID(p entql.IntP)

WhereID applies the entql int predicate on the id field.

func (*UserFilter) WherePassword

func (f *UserFilter) WherePassword(p entql.StringP)

WherePassword applies the entql string predicate on the password field.

func (*UserFilter) WhereProvider

func (f *UserFilter) WhereProvider(p entql.StringP)

WhereProvider applies the entql string predicate on the provider field.

func (*UserFilter) WhereProviderAvatar

func (f *UserFilter) WhereProviderAvatar(p entql.StringP)

WhereProviderAvatar applies the entql string predicate on the provider_avatar field.

func (*UserFilter) WhereProviderID

func (f *UserFilter) WhereProviderID(p entql.StringP)

WhereProviderID applies the entql string predicate on the provider_id field.

func (*UserFilter) WhereProviderUsername

func (f *UserFilter) WhereProviderUsername(p entql.StringP)

WhereProviderUsername applies the entql string predicate on the provider_username field.

func (*UserFilter) WhereURL

func (f *UserFilter) WhereURL(p entql.StringP)

WhereURL applies the entql string predicate on the url field.

func (*UserFilter) WhereUpdatedAt

func (f *UserFilter) WhereUpdatedAt(p entql.TimeP)

WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.

func (*UserFilter) WhereUsername

func (f *UserFilter) WhereUsername(p entql.StringP)

WhereUsername applies the entql string predicate on the username field.

type UserGroupBy

type UserGroupBy struct {
	// contains filtered or unexported fields
}

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserGroupBy) Bool

func (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) BoolX

func (ugb *UserGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserGroupBy) Bools

func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) BoolsX

func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserGroupBy) Float64

func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) Float64X

func (ugb *UserGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserGroupBy) Float64s

func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) Float64sX

func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserGroupBy) Int

func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) IntX

func (ugb *UserGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserGroupBy) Ints

func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) IntsX

func (ugb *UserGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*UserGroupBy) ScanX

func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UserGroupBy) String

func (ugb *UserGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) StringX

func (ugb *UserGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserGroupBy) Strings

func (ugb *UserGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) StringsX

func (ugb *UserGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserMutation

type UserMutation struct {
	// contains filtered or unexported fields
}

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) Active

func (m *UserMutation) Active() (r bool, exists bool)

Active returns the value of the "active" field in the mutation.

func (*UserMutation) AddCommentIDs

func (m *UserMutation) AddCommentIDs(ids ...int)

AddCommentIDs adds the "comments" edge to the Comment entity by ids.

func (*UserMutation) AddField

func (m *UserMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) AddFileIDs

func (m *UserMutation) AddFileIDs(ids ...int)

AddFileIDs adds the "files" edge to the File entity by ids.

func (*UserMutation) AddPostIDs

func (m *UserMutation) AddPostIDs(ids ...int)

AddPostIDs adds the "posts" edge to the Post entity by ids.

func (*UserMutation) AddRoleIDs

func (m *UserMutation) AddRoleIDs(ids ...int)

AddRoleIDs adds the "roles" edge to the Role entity by ids.

func (*UserMutation) AddedEdges

func (m *UserMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserMutation) AddedField

func (m *UserMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) AddedFields

func (m *UserMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserMutation) AddedIDs

func (m *UserMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserMutation) AvatarImageCleared

func (m *UserMutation) AvatarImageCleared() bool

AvatarImageCleared reports if the "avatar_image" edge to the File entity was cleared.

func (*UserMutation) AvatarImageID

func (m *UserMutation) AvatarImageID() (r int, exists bool)

AvatarImageID returns the value of the "avatar_image_id" field in the mutation.

func (*UserMutation) AvatarImageIDCleared

func (m *UserMutation) AvatarImageIDCleared() bool

AvatarImageIDCleared returns if the "avatar_image_id" field was cleared in this mutation.

func (*UserMutation) AvatarImageIDs

func (m *UserMutation) AvatarImageIDs() (ids []int)

AvatarImageIDs returns the "avatar_image" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use AvatarImageID instead. It exists only for internal usage by the builders.

func (*UserMutation) Bio

func (m *UserMutation) Bio() (r string, exists bool)

Bio returns the value of the "bio" field in the mutation.

func (*UserMutation) BioCleared

func (m *UserMutation) BioCleared() bool

BioCleared returns if the "bio" field was cleared in this mutation.

func (*UserMutation) BioHTML

func (m *UserMutation) BioHTML() (r string, exists bool)

BioHTML returns the value of the "bio_html" field in the mutation.

func (*UserMutation) BioHTMLCleared

func (m *UserMutation) BioHTMLCleared() bool

BioHTMLCleared returns if the "bio_html" field was cleared in this mutation.

func (*UserMutation) ClearAvatarImage

func (m *UserMutation) ClearAvatarImage()

ClearAvatarImage clears the "avatar_image" edge to the File entity.

func (*UserMutation) ClearAvatarImageID

func (m *UserMutation) ClearAvatarImageID()

ClearAvatarImageID clears the value of the "avatar_image_id" field.

func (*UserMutation) ClearBio

func (m *UserMutation) ClearBio()

ClearBio clears the value of the "bio" field.

func (*UserMutation) ClearBioHTML

func (m *UserMutation) ClearBioHTML()

ClearBioHTML clears the value of the "bio_html" field.

func (*UserMutation) ClearComments

func (m *UserMutation) ClearComments()

ClearComments clears the "comments" edge to the Comment entity.

func (*UserMutation) ClearDeletedAt

func (m *UserMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserMutation) ClearDisplayName

func (m *UserMutation) ClearDisplayName()

ClearDisplayName clears the value of the "display_name" field.

func (*UserMutation) ClearEdge

func (m *UserMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*UserMutation) ClearEmail

func (m *UserMutation) ClearEmail()

ClearEmail clears the value of the "email" field.

func (*UserMutation) ClearField

func (m *UserMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ClearFiles

func (m *UserMutation) ClearFiles()

ClearFiles clears the "files" edge to the File entity.

func (*UserMutation) ClearPassword

func (m *UserMutation) ClearPassword()

ClearPassword clears the value of the "password" field.

func (*UserMutation) ClearPosts

func (m *UserMutation) ClearPosts()

ClearPosts clears the "posts" edge to the Post entity.

func (*UserMutation) ClearProvider

func (m *UserMutation) ClearProvider()

ClearProvider clears the value of the "provider" field.

func (*UserMutation) ClearProviderAvatar

func (m *UserMutation) ClearProviderAvatar()

ClearProviderAvatar clears the value of the "provider_avatar" field.

func (*UserMutation) ClearProviderID

func (m *UserMutation) ClearProviderID()

ClearProviderID clears the value of the "provider_id" field.

func (*UserMutation) ClearProviderUsername

func (m *UserMutation) ClearProviderUsername()

ClearProviderUsername clears the value of the "provider_username" field.

func (*UserMutation) ClearRoles

func (m *UserMutation) ClearRoles()

ClearRoles clears the "roles" edge to the Role entity.

func (*UserMutation) ClearURL

func (m *UserMutation) ClearURL()

ClearURL clears the value of the "url" field.

func (*UserMutation) ClearedEdges

func (m *UserMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserMutation) ClearedFields

func (m *UserMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) CommentsCleared

func (m *UserMutation) CommentsCleared() bool

CommentsCleared reports if the "comments" edge to the Comment entity was cleared.

func (*UserMutation) CommentsIDs

func (m *UserMutation) CommentsIDs() (ids []int)

CommentsIDs returns the "comments" edge IDs in the mutation.

func (*UserMutation) CreatedAt

func (m *UserMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*UserMutation) DeletedAt

func (m *UserMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*UserMutation) DeletedAtCleared

func (m *UserMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*UserMutation) DisplayName

func (m *UserMutation) DisplayName() (r string, exists bool)

DisplayName returns the value of the "display_name" field in the mutation.

func (*UserMutation) DisplayNameCleared

func (m *UserMutation) DisplayNameCleared() bool

DisplayNameCleared returns if the "display_name" field was cleared in this mutation.

func (*UserMutation) EdgeCleared

func (m *UserMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserMutation) Email

func (m *UserMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*UserMutation) EmailCleared

func (m *UserMutation) EmailCleared() bool

EmailCleared returns if the "email" field was cleared in this mutation.

func (*UserMutation) Field

func (m *UserMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) FieldCleared

func (m *UserMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserMutation) Fields

func (m *UserMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*UserMutation) FilesCleared

func (m *UserMutation) FilesCleared() bool

FilesCleared reports if the "files" edge to the File entity was cleared.

func (*UserMutation) FilesIDs

func (m *UserMutation) FilesIDs() (ids []int)

FilesIDs returns the "files" edge IDs in the mutation.

func (*UserMutation) Filter

func (m *UserMutation) Filter() *UserFilter

Filter returns an entql.Where implementation to apply filters on the UserMutation builder.

func (*UserMutation) ID

func (m *UserMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserMutation) IDs

func (m *UserMutation) IDs(ctx context.Context) ([]int, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserMutation) OldActive

func (m *UserMutation) OldActive(ctx context.Context) (v bool, err error)

OldActive returns the old "active" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldAvatarImageID

func (m *UserMutation) OldAvatarImageID(ctx context.Context) (v int, err error)

OldAvatarImageID returns the old "avatar_image_id" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldBio

func (m *UserMutation) OldBio(ctx context.Context) (v string, err error)

OldBio returns the old "bio" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldBioHTML

func (m *UserMutation) OldBioHTML(ctx context.Context) (v string, err error)

OldBioHTML returns the old "bio_html" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldCreatedAt

func (m *UserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldDeletedAt

func (m *UserMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldDisplayName

func (m *UserMutation) OldDisplayName(ctx context.Context) (v string, err error)

OldDisplayName returns the old "display_name" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldEmail

func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old "email" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldField

func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*UserMutation) OldPassword

func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)

OldPassword returns the old "password" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldProvider

func (m *UserMutation) OldProvider(ctx context.Context) (v string, err error)

OldProvider returns the old "provider" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldProviderAvatar

func (m *UserMutation) OldProviderAvatar(ctx context.Context) (v string, err error)

OldProviderAvatar returns the old "provider_avatar" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldProviderID

func (m *UserMutation) OldProviderID(ctx context.Context) (v string, err error)

OldProviderID returns the old "provider_id" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldProviderUsername

func (m *UserMutation) OldProviderUsername(ctx context.Context) (v string, err error)

OldProviderUsername returns the old "provider_username" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldURL

func (m *UserMutation) OldURL(ctx context.Context) (v string, err error)

OldURL returns the old "url" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUpdatedAt

func (m *UserMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUsername

func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old "username" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) Password

func (m *UserMutation) Password() (r string, exists bool)

Password returns the value of the "password" field in the mutation.

func (*UserMutation) PasswordCleared

func (m *UserMutation) PasswordCleared() bool

PasswordCleared returns if the "password" field was cleared in this mutation.

func (*UserMutation) PostsCleared

func (m *UserMutation) PostsCleared() bool

PostsCleared reports if the "posts" edge to the Post entity was cleared.

func (*UserMutation) PostsIDs

func (m *UserMutation) PostsIDs() (ids []int)

PostsIDs returns the "posts" edge IDs in the mutation.

func (*UserMutation) Provider

func (m *UserMutation) Provider() (r string, exists bool)

Provider returns the value of the "provider" field in the mutation.

func (*UserMutation) ProviderAvatar

func (m *UserMutation) ProviderAvatar() (r string, exists bool)

ProviderAvatar returns the value of the "provider_avatar" field in the mutation.

func (*UserMutation) ProviderAvatarCleared

func (m *UserMutation) ProviderAvatarCleared() bool

ProviderAvatarCleared returns if the "provider_avatar" field was cleared in this mutation.

func (*UserMutation) ProviderCleared

func (m *UserMutation) ProviderCleared() bool

ProviderCleared returns if the "provider" field was cleared in this mutation.

func (*UserMutation) ProviderID

func (m *UserMutation) ProviderID() (r string, exists bool)

ProviderID returns the value of the "provider_id" field in the mutation.

func (*UserMutation) ProviderIDCleared

func (m *UserMutation) ProviderIDCleared() bool

ProviderIDCleared returns if the "provider_id" field was cleared in this mutation.

func (*UserMutation) ProviderUsername

func (m *UserMutation) ProviderUsername() (r string, exists bool)

ProviderUsername returns the value of the "provider_username" field in the mutation.

func (*UserMutation) ProviderUsernameCleared

func (m *UserMutation) ProviderUsernameCleared() bool

ProviderUsernameCleared returns if the "provider_username" field was cleared in this mutation.

func (*UserMutation) RemoveCommentIDs

func (m *UserMutation) RemoveCommentIDs(ids ...int)

RemoveCommentIDs removes the "comments" edge to the Comment entity by IDs.

func (*UserMutation) RemoveFileIDs

func (m *UserMutation) RemoveFileIDs(ids ...int)

RemoveFileIDs removes the "files" edge to the File entity by IDs.

func (*UserMutation) RemovePostIDs

func (m *UserMutation) RemovePostIDs(ids ...int)

RemovePostIDs removes the "posts" edge to the Post entity by IDs.

func (*UserMutation) RemoveRoleIDs

func (m *UserMutation) RemoveRoleIDs(ids ...int)

RemoveRoleIDs removes the "roles" edge to the Role entity by IDs.

func (*UserMutation) RemovedCommentsIDs

func (m *UserMutation) RemovedCommentsIDs() (ids []int)

RemovedComments returns the removed IDs of the "comments" edge to the Comment entity.

func (*UserMutation) RemovedEdges

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedFilesIDs

func (m *UserMutation) RemovedFilesIDs() (ids []int)

RemovedFiles returns the removed IDs of the "files" edge to the File entity.

func (*UserMutation) RemovedIDs

func (m *UserMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserMutation) RemovedPostsIDs

func (m *UserMutation) RemovedPostsIDs() (ids []int)

RemovedPosts returns the removed IDs of the "posts" edge to the Post entity.

func (*UserMutation) RemovedRolesIDs

func (m *UserMutation) RemovedRolesIDs() (ids []int)

RemovedRoles returns the removed IDs of the "roles" edge to the Role entity.

func (*UserMutation) ResetActive

func (m *UserMutation) ResetActive()

ResetActive resets all changes to the "active" field.

func (*UserMutation) ResetAvatarImage

func (m *UserMutation) ResetAvatarImage()

ResetAvatarImage resets all changes to the "avatar_image" edge.

func (*UserMutation) ResetAvatarImageID

func (m *UserMutation) ResetAvatarImageID()

ResetAvatarImageID resets all changes to the "avatar_image_id" field.

func (*UserMutation) ResetBio

func (m *UserMutation) ResetBio()

ResetBio resets all changes to the "bio" field.

func (*UserMutation) ResetBioHTML

func (m *UserMutation) ResetBioHTML()

ResetBioHTML resets all changes to the "bio_html" field.

func (*UserMutation) ResetComments

func (m *UserMutation) ResetComments()

ResetComments resets all changes to the "comments" edge.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetDeletedAt

func (m *UserMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*UserMutation) ResetDisplayName

func (m *UserMutation) ResetDisplayName()

ResetDisplayName resets all changes to the "display_name" field.

func (*UserMutation) ResetEdge

func (m *UserMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserMutation) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UserMutation) ResetField

func (m *UserMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ResetFiles

func (m *UserMutation) ResetFiles()

ResetFiles resets all changes to the "files" edge.

func (*UserMutation) ResetPassword

func (m *UserMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*UserMutation) ResetPosts

func (m *UserMutation) ResetPosts()

ResetPosts resets all changes to the "posts" edge.

func (*UserMutation) ResetProvider

func (m *UserMutation) ResetProvider()

ResetProvider resets all changes to the "provider" field.

func (*UserMutation) ResetProviderAvatar

func (m *UserMutation) ResetProviderAvatar()

ResetProviderAvatar resets all changes to the "provider_avatar" field.

func (*UserMutation) ResetProviderID

func (m *UserMutation) ResetProviderID()

ResetProviderID resets all changes to the "provider_id" field.

func (*UserMutation) ResetProviderUsername

func (m *UserMutation) ResetProviderUsername()

ResetProviderUsername resets all changes to the "provider_username" field.

func (*UserMutation) ResetRoles

func (m *UserMutation) ResetRoles()

ResetRoles resets all changes to the "roles" edge.

func (*UserMutation) ResetURL

func (m *UserMutation) ResetURL()

ResetURL resets all changes to the "url" field.

func (*UserMutation) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserMutation) ResetUsername

func (m *UserMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*UserMutation) RolesCleared

func (m *UserMutation) RolesCleared() bool

RolesCleared reports if the "roles" edge to the Role entity was cleared.

func (*UserMutation) RolesIDs

func (m *UserMutation) RolesIDs() (ids []int)

RolesIDs returns the "roles" edge IDs in the mutation.

func (*UserMutation) SetActive

func (m *UserMutation) SetActive(b bool)

SetActive sets the "active" field.

func (*UserMutation) SetAvatarImageID

func (m *UserMutation) SetAvatarImageID(i int)

SetAvatarImageID sets the "avatar_image_id" field.

func (*UserMutation) SetBio

func (m *UserMutation) SetBio(s string)

SetBio sets the "bio" field.

func (*UserMutation) SetBioHTML

func (m *UserMutation) SetBioHTML(s string)

SetBioHTML sets the "bio_html" field.

func (*UserMutation) SetCreatedAt

func (m *UserMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetDeletedAt

func (m *UserMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*UserMutation) SetDisplayName

func (m *UserMutation) SetDisplayName(s string)

SetDisplayName sets the "display_name" field.

func (*UserMutation) SetEmail

func (m *UserMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*UserMutation) SetField

func (m *UserMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) SetPassword

func (m *UserMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*UserMutation) SetProvider

func (m *UserMutation) SetProvider(s string)

SetProvider sets the "provider" field.

func (*UserMutation) SetProviderAvatar

func (m *UserMutation) SetProviderAvatar(s string)

SetProviderAvatar sets the "provider_avatar" field.

func (*UserMutation) SetProviderID

func (m *UserMutation) SetProviderID(s string)

SetProviderID sets the "provider_id" field.

func (*UserMutation) SetProviderUsername

func (m *UserMutation) SetProviderUsername(s string)

SetProviderUsername sets the "provider_username" field.

func (*UserMutation) SetURL

func (m *UserMutation) SetURL(s string)

SetURL sets the "url" field.

func (*UserMutation) SetUpdatedAt

func (m *UserMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*UserMutation) SetUsername

func (m *UserMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (UserMutation) Tx

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) URL

func (m *UserMutation) URL() (r string, exists bool)

URL returns the value of the "url" field in the mutation.

func (*UserMutation) URLCleared

func (m *UserMutation) URLCleared() bool

URLCleared returns if the "url" field was cleared in this mutation.

func (*UserMutation) UpdatedAt

func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*UserMutation) Username

func (m *UserMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

type UserQuery

type UserQuery struct {
	// contains filtered or unexported fields
}

UserQuery is the builder for querying User entities.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

AllX is like All, but panics if an error occurs.

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserQuery) Filter

func (uq *UserQuery) Filter() *UserFilter

Filter returns a Filter implementation to apply filters on the UserQuery builder.

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

First returns the first User entity from the query. Returns a *NotFoundError when no User was found.

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

FirstX is like First, but panics if an error occurs.

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreatedAt time.Time `json:"omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of User IDs.

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit adds a limit step to the query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset adds an offset step to the query.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

OnlyX is like Only, but panics if an error occurs.

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery

Order adds an order step to the query.

func (*UserQuery) QueryAvatarImage

func (uq *UserQuery) QueryAvatarImage() *FileQuery

QueryAvatarImage chains the current query on the "avatar_image" edge.

func (*UserQuery) QueryComments

func (uq *UserQuery) QueryComments() *CommentQuery

QueryComments chains the current query on the "comments" edge.

func (*UserQuery) QueryFiles

func (uq *UserQuery) QueryFiles() *FileQuery

QueryFiles chains the current query on the "files" edge.

func (*UserQuery) QueryPosts

func (uq *UserQuery) QueryPosts() *PostQuery

QueryPosts chains the current query on the "posts" edge.

func (*UserQuery) QueryRoles

func (uq *UserQuery) QueryRoles() *RoleQuery

QueryRoles chains the current query on the "roles" edge.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *UserSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreatedAt time.Time `json:"omitempty"`
}

client.User.Query().
	Select(user.FieldCreatedAt).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *UserQuery) Unique(unique bool) *UserQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithAvatarImage

func (uq *UserQuery) WithAvatarImage(opts ...func(*FileQuery)) *UserQuery

WithAvatarImage tells the query-builder to eager-load the nodes that are connected to the "avatar_image" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithComments

func (uq *UserQuery) WithComments(opts ...func(*CommentQuery)) *UserQuery

WithComments tells the query-builder to eager-load the nodes that are connected to the "comments" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithFiles

func (uq *UserQuery) WithFiles(opts ...func(*FileQuery)) *UserQuery

WithFiles tells the query-builder to eager-load the nodes that are connected to the "files" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithPosts

func (uq *UserQuery) WithPosts(opts ...func(*PostQuery)) *UserQuery

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 (*UserQuery) WithRoles

func (uq *UserQuery) WithRoles(opts ...func(*RoleQuery)) *UserQuery

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.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Bool

func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolX

func (us *UserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSelect) Bools

func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolsX

func (us *UserSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSelect) Float64

func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64X

func (us *UserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSelect) Float64s

func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64sX

func (us *UserSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSelect) Int

func (us *UserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntX

func (us *UserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSelect) Ints

func (us *UserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntsX

func (us *UserSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*UserSelect) ScanX

func (us *UserSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UserSelect) String

func (us *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX

func (us *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings

func (us *UserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringsX

func (us *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserUpdate

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddCommentIDs

func (uu *UserUpdate) AddCommentIDs(ids ...int) *UserUpdate

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*UserUpdate) AddComments

func (uu *UserUpdate) AddComments(c ...*Comment) *UserUpdate

AddComments adds the "comments" edges to the Comment entity.

func (*UserUpdate) AddFileIDs

func (uu *UserUpdate) AddFileIDs(ids ...int) *UserUpdate

AddFileIDs adds the "files" edge to the File entity by IDs.

func (*UserUpdate) AddFiles

func (uu *UserUpdate) AddFiles(f ...*File) *UserUpdate

AddFiles adds the "files" edges to the File entity.

func (*UserUpdate) AddPostIDs

func (uu *UserUpdate) AddPostIDs(ids ...int) *UserUpdate

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*UserUpdate) AddPosts

func (uu *UserUpdate) AddPosts(p ...*Post) *UserUpdate

AddPosts adds the "posts" edges to the Post entity.

func (*UserUpdate) AddRoleIDs

func (uu *UserUpdate) AddRoleIDs(ids ...int) *UserUpdate

AddRoleIDs adds the "roles" edge to the Role entity by IDs.

func (*UserUpdate) AddRoles

func (uu *UserUpdate) AddRoles(r ...*Role) *UserUpdate

AddRoles adds the "roles" edges to the Role entity.

func (*UserUpdate) ClearAvatarImage

func (uu *UserUpdate) ClearAvatarImage() *UserUpdate

ClearAvatarImage clears the "avatar_image" edge to the File entity.

func (*UserUpdate) ClearAvatarImageID

func (uu *UserUpdate) ClearAvatarImageID() *UserUpdate

ClearAvatarImageID clears the value of the "avatar_image_id" field.

func (*UserUpdate) ClearBio

func (uu *UserUpdate) ClearBio() *UserUpdate

ClearBio clears the value of the "bio" field.

func (*UserUpdate) ClearBioHTML

func (uu *UserUpdate) ClearBioHTML() *UserUpdate

ClearBioHTML clears the value of the "bio_html" field.

func (*UserUpdate) ClearComments

func (uu *UserUpdate) ClearComments() *UserUpdate

ClearComments clears all "comments" edges to the Comment entity.

func (*UserUpdate) ClearDeletedAt

func (uu *UserUpdate) ClearDeletedAt() *UserUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserUpdate) ClearDisplayName

func (uu *UserUpdate) ClearDisplayName() *UserUpdate

ClearDisplayName clears the value of the "display_name" field.

func (*UserUpdate) ClearEmail

func (uu *UserUpdate) ClearEmail() *UserUpdate

ClearEmail clears the value of the "email" field.

func (*UserUpdate) ClearFiles

func (uu *UserUpdate) ClearFiles() *UserUpdate

ClearFiles clears all "files" edges to the File entity.

func (*UserUpdate) ClearPassword

func (uu *UserUpdate) ClearPassword() *UserUpdate

ClearPassword clears the value of the "password" field.

func (*UserUpdate) ClearPosts

func (uu *UserUpdate) ClearPosts() *UserUpdate

ClearPosts clears all "posts" edges to the Post entity.

func (*UserUpdate) ClearProvider

func (uu *UserUpdate) ClearProvider() *UserUpdate

ClearProvider clears the value of the "provider" field.

func (*UserUpdate) ClearProviderAvatar

func (uu *UserUpdate) ClearProviderAvatar() *UserUpdate

ClearProviderAvatar clears the value of the "provider_avatar" field.

func (*UserUpdate) ClearProviderID

func (uu *UserUpdate) ClearProviderID() *UserUpdate

ClearProviderID clears the value of the "provider_id" field.

func (*UserUpdate) ClearProviderUsername

func (uu *UserUpdate) ClearProviderUsername() *UserUpdate

ClearProviderUsername clears the value of the "provider_username" field.

func (*UserUpdate) ClearRoles

func (uu *UserUpdate) ClearRoles() *UserUpdate

ClearRoles clears all "roles" edges to the Role entity.

func (*UserUpdate) ClearURL

func (uu *UserUpdate) ClearURL() *UserUpdate

ClearURL clears the value of the "url" field.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveCommentIDs

func (uu *UserUpdate) RemoveCommentIDs(ids ...int) *UserUpdate

RemoveCommentIDs removes the "comments" edge to Comment entities by IDs.

func (*UserUpdate) RemoveComments

func (uu *UserUpdate) RemoveComments(c ...*Comment) *UserUpdate

RemoveComments removes "comments" edges to Comment entities.

func (*UserUpdate) RemoveFileIDs

func (uu *UserUpdate) RemoveFileIDs(ids ...int) *UserUpdate

RemoveFileIDs removes the "files" edge to File entities by IDs.

func (*UserUpdate) RemoveFiles

func (uu *UserUpdate) RemoveFiles(f ...*File) *UserUpdate

RemoveFiles removes "files" edges to File entities.

func (*UserUpdate) RemovePostIDs

func (uu *UserUpdate) RemovePostIDs(ids ...int) *UserUpdate

RemovePostIDs removes the "posts" edge to Post entities by IDs.

func (*UserUpdate) RemovePosts

func (uu *UserUpdate) RemovePosts(p ...*Post) *UserUpdate

RemovePosts removes "posts" edges to Post entities.

func (*UserUpdate) RemoveRoleIDs

func (uu *UserUpdate) RemoveRoleIDs(ids ...int) *UserUpdate

RemoveRoleIDs removes the "roles" edge to Role entities by IDs.

func (*UserUpdate) RemoveRoles

func (uu *UserUpdate) RemoveRoles(r ...*Role) *UserUpdate

RemoveRoles removes "roles" edges to Role entities.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserUpdate) SetActive

func (uu *UserUpdate) SetActive(b bool) *UserUpdate

SetActive sets the "active" field.

func (*UserUpdate) SetAvatarImage

func (uu *UserUpdate) SetAvatarImage(f *File) *UserUpdate

SetAvatarImage sets the "avatar_image" edge to the File entity.

func (*UserUpdate) SetAvatarImageID

func (uu *UserUpdate) SetAvatarImageID(i int) *UserUpdate

SetAvatarImageID sets the "avatar_image_id" field.

func (*UserUpdate) SetBio

func (uu *UserUpdate) SetBio(s string) *UserUpdate

SetBio sets the "bio" field.

func (*UserUpdate) SetBioHTML

func (uu *UserUpdate) SetBioHTML(s string) *UserUpdate

SetBioHTML sets the "bio_html" field.

func (*UserUpdate) SetDeletedAt

func (uu *UserUpdate) SetDeletedAt(t time.Time) *UserUpdate

SetDeletedAt sets the "deleted_at" field.

func (*UserUpdate) SetDisplayName

func (uu *UserUpdate) SetDisplayName(s string) *UserUpdate

SetDisplayName sets the "display_name" field.

func (*UserUpdate) SetEmail

func (uu *UserUpdate) SetEmail(s string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetNillableActive

func (uu *UserUpdate) SetNillableActive(b *bool) *UserUpdate

SetNillableActive sets the "active" field if the given value is not nil.

func (*UserUpdate) SetNillableAvatarImageID

func (uu *UserUpdate) SetNillableAvatarImageID(i *int) *UserUpdate

SetNillableAvatarImageID sets the "avatar_image_id" field if the given value is not nil.

func (*UserUpdate) SetNillableBio

func (uu *UserUpdate) SetNillableBio(s *string) *UserUpdate

SetNillableBio sets the "bio" field if the given value is not nil.

func (*UserUpdate) SetNillableBioHTML

func (uu *UserUpdate) SetNillableBioHTML(s *string) *UserUpdate

SetNillableBioHTML sets the "bio_html" field if the given value is not nil.

func (*UserUpdate) SetNillableDeletedAt

func (uu *UserUpdate) SetNillableDeletedAt(t *time.Time) *UserUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*UserUpdate) SetNillableDisplayName

func (uu *UserUpdate) SetNillableDisplayName(s *string) *UserUpdate

SetNillableDisplayName sets the "display_name" field if the given value is not nil.

func (*UserUpdate) SetNillableEmail

func (uu *UserUpdate) SetNillableEmail(s *string) *UserUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdate) SetNillablePassword

func (uu *UserUpdate) SetNillablePassword(s *string) *UserUpdate

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UserUpdate) SetNillableProvider

func (uu *UserUpdate) SetNillableProvider(s *string) *UserUpdate

SetNillableProvider sets the "provider" field if the given value is not nil.

func (*UserUpdate) SetNillableProviderAvatar

func (uu *UserUpdate) SetNillableProviderAvatar(s *string) *UserUpdate

SetNillableProviderAvatar sets the "provider_avatar" field if the given value is not nil.

func (*UserUpdate) SetNillableProviderID

func (uu *UserUpdate) SetNillableProviderID(s *string) *UserUpdate

SetNillableProviderID sets the "provider_id" field if the given value is not nil.

func (*UserUpdate) SetNillableProviderUsername

func (uu *UserUpdate) SetNillableProviderUsername(s *string) *UserUpdate

SetNillableProviderUsername sets the "provider_username" field if the given value is not nil.

func (*UserUpdate) SetNillableURL

func (uu *UserUpdate) SetNillableURL(s *string) *UserUpdate

SetNillableURL sets the "url" field if the given value is not nil.

func (*UserUpdate) SetPassword

func (uu *UserUpdate) SetPassword(s string) *UserUpdate

SetPassword sets the "password" field.

func (*UserUpdate) SetProvider

func (uu *UserUpdate) SetProvider(s string) *UserUpdate

SetProvider sets the "provider" field.

func (*UserUpdate) SetProviderAvatar

func (uu *UserUpdate) SetProviderAvatar(s string) *UserUpdate

SetProviderAvatar sets the "provider_avatar" field.

func (*UserUpdate) SetProviderID

func (uu *UserUpdate) SetProviderID(s string) *UserUpdate

SetProviderID sets the "provider_id" field.

func (*UserUpdate) SetProviderUsername

func (uu *UserUpdate) SetProviderUsername(s string) *UserUpdate

SetProviderUsername sets the "provider_username" field.

func (*UserUpdate) SetURL

func (uu *UserUpdate) SetURL(s string) *UserUpdate

SetURL sets the "url" field.

func (*UserUpdate) SetUpdatedAt

func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdate) SetUsername

func (uu *UserUpdate) SetUsername(s string) *UserUpdate

SetUsername sets the "username" field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

type UserUpdateOne struct {
	// contains filtered or unexported fields
}

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddCommentIDs

func (uuo *UserUpdateOne) AddCommentIDs(ids ...int) *UserUpdateOne

AddCommentIDs adds the "comments" edge to the Comment entity by IDs.

func (*UserUpdateOne) AddComments

func (uuo *UserUpdateOne) AddComments(c ...*Comment) *UserUpdateOne

AddComments adds the "comments" edges to the Comment entity.

func (*UserUpdateOne) AddFileIDs

func (uuo *UserUpdateOne) AddFileIDs(ids ...int) *UserUpdateOne

AddFileIDs adds the "files" edge to the File entity by IDs.

func (*UserUpdateOne) AddFiles

func (uuo *UserUpdateOne) AddFiles(f ...*File) *UserUpdateOne

AddFiles adds the "files" edges to the File entity.

func (*UserUpdateOne) AddPostIDs

func (uuo *UserUpdateOne) AddPostIDs(ids ...int) *UserUpdateOne

AddPostIDs adds the "posts" edge to the Post entity by IDs.

func (*UserUpdateOne) AddPosts

func (uuo *UserUpdateOne) AddPosts(p ...*Post) *UserUpdateOne

AddPosts adds the "posts" edges to the Post entity.

func (*UserUpdateOne) AddRoleIDs

func (uuo *UserUpdateOne) AddRoleIDs(ids ...int) *UserUpdateOne

AddRoleIDs adds the "roles" edge to the Role entity by IDs.

func (*UserUpdateOne) AddRoles

func (uuo *UserUpdateOne) AddRoles(r ...*Role) *UserUpdateOne

AddRoles adds the "roles" edges to the Role entity.

func (*UserUpdateOne) ClearAvatarImage

func (uuo *UserUpdateOne) ClearAvatarImage() *UserUpdateOne

ClearAvatarImage clears the "avatar_image" edge to the File entity.

func (*UserUpdateOne) ClearAvatarImageID

func (uuo *UserUpdateOne) ClearAvatarImageID() *UserUpdateOne

ClearAvatarImageID clears the value of the "avatar_image_id" field.

func (*UserUpdateOne) ClearBio

func (uuo *UserUpdateOne) ClearBio() *UserUpdateOne

ClearBio clears the value of the "bio" field.

func (*UserUpdateOne) ClearBioHTML

func (uuo *UserUpdateOne) ClearBioHTML() *UserUpdateOne

ClearBioHTML clears the value of the "bio_html" field.

func (*UserUpdateOne) ClearComments

func (uuo *UserUpdateOne) ClearComments() *UserUpdateOne

ClearComments clears all "comments" edges to the Comment entity.

func (*UserUpdateOne) ClearDeletedAt

func (uuo *UserUpdateOne) ClearDeletedAt() *UserUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserUpdateOne) ClearDisplayName

func (uuo *UserUpdateOne) ClearDisplayName() *UserUpdateOne

ClearDisplayName clears the value of the "display_name" field.

func (*UserUpdateOne) ClearEmail

func (uuo *UserUpdateOne) ClearEmail() *UserUpdateOne

ClearEmail clears the value of the "email" field.

func (*UserUpdateOne) ClearFiles

func (uuo *UserUpdateOne) ClearFiles() *UserUpdateOne

ClearFiles clears all "files" edges to the File entity.

func (*UserUpdateOne) ClearPassword

func (uuo *UserUpdateOne) ClearPassword() *UserUpdateOne

ClearPassword clears the value of the "password" field.

func (*UserUpdateOne) ClearPosts

func (uuo *UserUpdateOne) ClearPosts() *UserUpdateOne

ClearPosts clears all "posts" edges to the Post entity.

func (*UserUpdateOne) ClearProvider

func (uuo *UserUpdateOne) ClearProvider() *UserUpdateOne

ClearProvider clears the value of the "provider" field.

func (*UserUpdateOne) ClearProviderAvatar

func (uuo *UserUpdateOne) ClearProviderAvatar() *UserUpdateOne

ClearProviderAvatar clears the value of the "provider_avatar" field.

func (*UserUpdateOne) ClearProviderID

func (uuo *UserUpdateOne) ClearProviderID() *UserUpdateOne

ClearProviderID clears the value of the "provider_id" field.

func (*UserUpdateOne) ClearProviderUsername

func (uuo *UserUpdateOne) ClearProviderUsername() *UserUpdateOne

ClearProviderUsername clears the value of the "provider_username" field.

func (*UserUpdateOne) ClearRoles

func (uuo *UserUpdateOne) ClearRoles() *UserUpdateOne

ClearRoles clears all "roles" edges to the Role entity.

func (*UserUpdateOne) ClearURL

func (uuo *UserUpdateOne) ClearURL() *UserUpdateOne

ClearURL clears the value of the "url" field.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveCommentIDs

func (uuo *UserUpdateOne) RemoveCommentIDs(ids ...int) *UserUpdateOne

RemoveCommentIDs removes the "comments" edge to Comment entities by IDs.

func (*UserUpdateOne) RemoveComments

func (uuo *UserUpdateOne) RemoveComments(c ...*Comment) *UserUpdateOne

RemoveComments removes "comments" edges to Comment entities.

func (*UserUpdateOne) RemoveFileIDs

func (uuo *UserUpdateOne) RemoveFileIDs(ids ...int) *UserUpdateOne

RemoveFileIDs removes the "files" edge to File entities by IDs.

func (*UserUpdateOne) RemoveFiles

func (uuo *UserUpdateOne) RemoveFiles(f ...*File) *UserUpdateOne

RemoveFiles removes "files" edges to File entities.

func (*UserUpdateOne) RemovePostIDs

func (uuo *UserUpdateOne) RemovePostIDs(ids ...int) *UserUpdateOne

RemovePostIDs removes the "posts" edge to Post entities by IDs.

func (*UserUpdateOne) RemovePosts

func (uuo *UserUpdateOne) RemovePosts(p ...*Post) *UserUpdateOne

RemovePosts removes "posts" edges to Post entities.

func (*UserUpdateOne) RemoveRoleIDs

func (uuo *UserUpdateOne) RemoveRoleIDs(ids ...int) *UserUpdateOne

RemoveRoleIDs removes the "roles" edge to Role entities by IDs.

func (*UserUpdateOne) RemoveRoles

func (uuo *UserUpdateOne) RemoveRoles(r ...*Role) *UserUpdateOne

RemoveRoles removes "roles" edges to Role entities.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

SaveX is like Save, but panics if an error occurs.

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserUpdateOne) SetActive

func (uuo *UserUpdateOne) SetActive(b bool) *UserUpdateOne

SetActive sets the "active" field.

func (*UserUpdateOne) SetAvatarImage

func (uuo *UserUpdateOne) SetAvatarImage(f *File) *UserUpdateOne

SetAvatarImage sets the "avatar_image" edge to the File entity.

func (*UserUpdateOne) SetAvatarImageID

func (uuo *UserUpdateOne) SetAvatarImageID(i int) *UserUpdateOne

SetAvatarImageID sets the "avatar_image_id" field.

func (*UserUpdateOne) SetBio

func (uuo *UserUpdateOne) SetBio(s string) *UserUpdateOne

SetBio sets the "bio" field.

func (*UserUpdateOne) SetBioHTML

func (uuo *UserUpdateOne) SetBioHTML(s string) *UserUpdateOne

SetBioHTML sets the "bio_html" field.

func (*UserUpdateOne) SetDeletedAt

func (uuo *UserUpdateOne) SetDeletedAt(t time.Time) *UserUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*UserUpdateOne) SetDisplayName

func (uuo *UserUpdateOne) SetDisplayName(s string) *UserUpdateOne

SetDisplayName sets the "display_name" field.

func (*UserUpdateOne) SetEmail

func (uuo *UserUpdateOne) SetEmail(s string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetNillableActive

func (uuo *UserUpdateOne) SetNillableActive(b *bool) *UserUpdateOne

SetNillableActive sets the "active" field if the given value is not nil.

func (*UserUpdateOne) SetNillableAvatarImageID

func (uuo *UserUpdateOne) SetNillableAvatarImageID(i *int) *UserUpdateOne

SetNillableAvatarImageID sets the "avatar_image_id" field if the given value is not nil.

func (*UserUpdateOne) SetNillableBio

func (uuo *UserUpdateOne) SetNillableBio(s *string) *UserUpdateOne

SetNillableBio sets the "bio" field if the given value is not nil.

func (*UserUpdateOne) SetNillableBioHTML

func (uuo *UserUpdateOne) SetNillableBioHTML(s *string) *UserUpdateOne

SetNillableBioHTML sets the "bio_html" field if the given value is not nil.

func (*UserUpdateOne) SetNillableDeletedAt

func (uuo *UserUpdateOne) SetNillableDeletedAt(t *time.Time) *UserUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*UserUpdateOne) SetNillableDisplayName

func (uuo *UserUpdateOne) SetNillableDisplayName(s *string) *UserUpdateOne

SetNillableDisplayName sets the "display_name" field if the given value is not nil.

func (*UserUpdateOne) SetNillableEmail

func (uuo *UserUpdateOne) SetNillableEmail(s *string) *UserUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePassword

func (uuo *UserUpdateOne) SetNillablePassword(s *string) *UserUpdateOne

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UserUpdateOne) SetNillableProvider

func (uuo *UserUpdateOne) SetNillableProvider(s *string) *UserUpdateOne

SetNillableProvider sets the "provider" field if the given value is not nil.

func (*UserUpdateOne) SetNillableProviderAvatar

func (uuo *UserUpdateOne) SetNillableProviderAvatar(s *string) *UserUpdateOne

SetNillableProviderAvatar sets the "provider_avatar" field if the given value is not nil.

func (*UserUpdateOne) SetNillableProviderID

func (uuo *UserUpdateOne) SetNillableProviderID(s *string) *UserUpdateOne

SetNillableProviderID sets the "provider_id" field if the given value is not nil.

func (*UserUpdateOne) SetNillableProviderUsername

func (uuo *UserUpdateOne) SetNillableProviderUsername(s *string) *UserUpdateOne

SetNillableProviderUsername sets the "provider_username" field if the given value is not nil.

func (*UserUpdateOne) SetNillableURL

func (uuo *UserUpdateOne) SetNillableURL(s *string) *UserUpdateOne

SetNillableURL sets the "url" field if the given value is not nil.

func (*UserUpdateOne) SetPassword

func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne

SetPassword sets the "password" field.

func (*UserUpdateOne) SetProvider

func (uuo *UserUpdateOne) SetProvider(s string) *UserUpdateOne

SetProvider sets the "provider" field.

func (*UserUpdateOne) SetProviderAvatar

func (uuo *UserUpdateOne) SetProviderAvatar(s string) *UserUpdateOne

SetProviderAvatar sets the "provider_avatar" field.

func (*UserUpdateOne) SetProviderID

func (uuo *UserUpdateOne) SetProviderID(s string) *UserUpdateOne

SetProviderID sets the "provider_id" field.

func (*UserUpdateOne) SetProviderUsername

func (uuo *UserUpdateOne) SetProviderUsername(s string) *UserUpdateOne

SetProviderUsername sets the "provider_username" field.

func (*UserUpdateOne) SetURL

func (uuo *UserUpdateOne) SetURL(s string) *UserUpdateOne

SetURL sets the "url" field.

func (*UserUpdateOne) SetUpdatedAt

func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdateOne) SetUsername

func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne

SetUsername sets the "username" field.

type UserUpsert

type UserUpsert struct {
	*sql.UpdateSet
}

UserUpsert is the "OnConflict" setter.

func (*UserUpsert) ClearAvatarImageID

func (u *UserUpsert) ClearAvatarImageID() *UserUpsert

ClearAvatarImageID clears the value of the "avatar_image_id" field.

func (*UserUpsert) ClearBio

func (u *UserUpsert) ClearBio() *UserUpsert

ClearBio clears the value of the "bio" field.

func (*UserUpsert) ClearBioHTML

func (u *UserUpsert) ClearBioHTML() *UserUpsert

ClearBioHTML clears the value of the "bio_html" field.

func (*UserUpsert) ClearDeletedAt

func (u *UserUpsert) ClearDeletedAt() *UserUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserUpsert) ClearDisplayName

func (u *UserUpsert) ClearDisplayName() *UserUpsert

ClearDisplayName clears the value of the "display_name" field.

func (*UserUpsert) ClearEmail

func (u *UserUpsert) ClearEmail() *UserUpsert

ClearEmail clears the value of the "email" field.

func (*UserUpsert) ClearPassword

func (u *UserUpsert) ClearPassword() *UserUpsert

ClearPassword clears the value of the "password" field.

func (*UserUpsert) ClearProvider

func (u *UserUpsert) ClearProvider() *UserUpsert

ClearProvider clears the value of the "provider" field.

func (*UserUpsert) ClearProviderAvatar

func (u *UserUpsert) ClearProviderAvatar() *UserUpsert

ClearProviderAvatar clears the value of the "provider_avatar" field.

func (*UserUpsert) ClearProviderID

func (u *UserUpsert) ClearProviderID() *UserUpsert

ClearProviderID clears the value of the "provider_id" field.

func (*UserUpsert) ClearProviderUsername

func (u *UserUpsert) ClearProviderUsername() *UserUpsert

ClearProviderUsername clears the value of the "provider_username" field.

func (*UserUpsert) ClearURL

func (u *UserUpsert) ClearURL() *UserUpsert

ClearURL clears the value of the "url" field.

func (*UserUpsert) SetActive

func (u *UserUpsert) SetActive(v bool) *UserUpsert

SetActive sets the "active" field.

func (*UserUpsert) SetAvatarImageID

func (u *UserUpsert) SetAvatarImageID(v int) *UserUpsert

SetAvatarImageID sets the "avatar_image_id" field.

func (*UserUpsert) SetBio

func (u *UserUpsert) SetBio(v string) *UserUpsert

SetBio sets the "bio" field.

func (*UserUpsert) SetBioHTML

func (u *UserUpsert) SetBioHTML(v string) *UserUpsert

SetBioHTML sets the "bio_html" field.

func (*UserUpsert) SetCreatedAt

func (u *UserUpsert) SetCreatedAt(v time.Time) *UserUpsert

SetCreatedAt sets the "created_at" field.

func (*UserUpsert) SetDeletedAt

func (u *UserUpsert) SetDeletedAt(v time.Time) *UserUpsert

SetDeletedAt sets the "deleted_at" field.

func (*UserUpsert) SetDisplayName

func (u *UserUpsert) SetDisplayName(v string) *UserUpsert

SetDisplayName sets the "display_name" field.

func (*UserUpsert) SetEmail

func (u *UserUpsert) SetEmail(v string) *UserUpsert

SetEmail sets the "email" field.

func (*UserUpsert) SetPassword

func (u *UserUpsert) SetPassword(v string) *UserUpsert

SetPassword sets the "password" field.

func (*UserUpsert) SetProvider

func (u *UserUpsert) SetProvider(v string) *UserUpsert

SetProvider sets the "provider" field.

func (*UserUpsert) SetProviderAvatar

func (u *UserUpsert) SetProviderAvatar(v string) *UserUpsert

SetProviderAvatar sets the "provider_avatar" field.

func (*UserUpsert) SetProviderID

func (u *UserUpsert) SetProviderID(v string) *UserUpsert

SetProviderID sets the "provider_id" field.

func (*UserUpsert) SetProviderUsername

func (u *UserUpsert) SetProviderUsername(v string) *UserUpsert

SetProviderUsername sets the "provider_username" field.

func (*UserUpsert) SetURL

func (u *UserUpsert) SetURL(v string) *UserUpsert

SetURL sets the "url" field.

func (*UserUpsert) SetUpdatedAt

func (u *UserUpsert) SetUpdatedAt(v time.Time) *UserUpsert

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsert) SetUsername

func (u *UserUpsert) SetUsername(v string) *UserUpsert

SetUsername sets the "username" field.

func (*UserUpsert) UpdateActive

func (u *UserUpsert) UpdateActive() *UserUpsert

UpdateActive sets the "active" field to the value that was provided on create.

func (*UserUpsert) UpdateAvatarImageID

func (u *UserUpsert) UpdateAvatarImageID() *UserUpsert

UpdateAvatarImageID sets the "avatar_image_id" field to the value that was provided on create.

func (*UserUpsert) UpdateBio

func (u *UserUpsert) UpdateBio() *UserUpsert

UpdateBio sets the "bio" field to the value that was provided on create.

func (*UserUpsert) UpdateBioHTML

func (u *UserUpsert) UpdateBioHTML() *UserUpsert

UpdateBioHTML sets the "bio_html" field to the value that was provided on create.

func (*UserUpsert) UpdateCreatedAt

func (u *UserUpsert) UpdateCreatedAt() *UserUpsert

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*UserUpsert) UpdateDeletedAt

func (u *UserUpsert) UpdateDeletedAt() *UserUpsert

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*UserUpsert) UpdateDisplayName

func (u *UserUpsert) UpdateDisplayName() *UserUpsert

UpdateDisplayName sets the "display_name" field to the value that was provided on create.

func (*UserUpsert) UpdateEmail

func (u *UserUpsert) UpdateEmail() *UserUpsert

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsert) UpdatePassword

func (u *UserUpsert) UpdatePassword() *UserUpsert

UpdatePassword sets the "password" field to the value that was provided on create.

func (*UserUpsert) UpdateProvider

func (u *UserUpsert) UpdateProvider() *UserUpsert

UpdateProvider sets the "provider" field to the value that was provided on create.

func (*UserUpsert) UpdateProviderAvatar

func (u *UserUpsert) UpdateProviderAvatar() *UserUpsert

UpdateProviderAvatar sets the "provider_avatar" field to the value that was provided on create.

func (*UserUpsert) UpdateProviderID

func (u *UserUpsert) UpdateProviderID() *UserUpsert

UpdateProviderID sets the "provider_id" field to the value that was provided on create.

func (*UserUpsert) UpdateProviderUsername

func (u *UserUpsert) UpdateProviderUsername() *UserUpsert

UpdateProviderUsername sets the "provider_username" field to the value that was provided on create.

func (*UserUpsert) UpdateURL

func (u *UserUpsert) UpdateURL() *UserUpsert

UpdateURL sets the "url" field to the value that was provided on create.

func (*UserUpsert) UpdateUpdatedAt

func (u *UserUpsert) UpdateUpdatedAt() *UserUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*UserUpsert) UpdateUsername

func (u *UserUpsert) UpdateUsername() *UserUpsert

UpdateUsername sets the "username" field to the value that was provided on create.

type UserUpsertBulk

type UserUpsertBulk struct {
	// contains filtered or unexported fields
}

UserUpsertBulk is the builder for "upsert"-ing a bulk of User nodes.

func (*UserUpsertBulk) ClearAvatarImageID

func (u *UserUpsertBulk) ClearAvatarImageID() *UserUpsertBulk

ClearAvatarImageID clears the value of the "avatar_image_id" field.

func (*UserUpsertBulk) ClearBio

func (u *UserUpsertBulk) ClearBio() *UserUpsertBulk

ClearBio clears the value of the "bio" field.

func (*UserUpsertBulk) ClearBioHTML

func (u *UserUpsertBulk) ClearBioHTML() *UserUpsertBulk

ClearBioHTML clears the value of the "bio_html" field.

func (*UserUpsertBulk) ClearDeletedAt

func (u *UserUpsertBulk) ClearDeletedAt() *UserUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserUpsertBulk) ClearDisplayName

func (u *UserUpsertBulk) ClearDisplayName() *UserUpsertBulk

ClearDisplayName clears the value of the "display_name" field.

func (*UserUpsertBulk) ClearEmail

func (u *UserUpsertBulk) ClearEmail() *UserUpsertBulk

ClearEmail clears the value of the "email" field.

func (*UserUpsertBulk) ClearPassword

func (u *UserUpsertBulk) ClearPassword() *UserUpsertBulk

ClearPassword clears the value of the "password" field.

func (*UserUpsertBulk) ClearProvider

func (u *UserUpsertBulk) ClearProvider() *UserUpsertBulk

ClearProvider clears the value of the "provider" field.

func (*UserUpsertBulk) ClearProviderAvatar

func (u *UserUpsertBulk) ClearProviderAvatar() *UserUpsertBulk

ClearProviderAvatar clears the value of the "provider_avatar" field.

func (*UserUpsertBulk) ClearProviderID

func (u *UserUpsertBulk) ClearProviderID() *UserUpsertBulk

ClearProviderID clears the value of the "provider_id" field.

func (*UserUpsertBulk) ClearProviderUsername

func (u *UserUpsertBulk) ClearProviderUsername() *UserUpsertBulk

ClearProviderUsername clears the value of the "provider_username" field.

func (*UserUpsertBulk) ClearURL

func (u *UserUpsertBulk) ClearURL() *UserUpsertBulk

ClearURL clears the value of the "url" field.

func (*UserUpsertBulk) DoNothing

func (u *UserUpsertBulk) DoNothing() *UserUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserUpsertBulk) Exec

func (u *UserUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpsertBulk) ExecX

func (u *UserUpsertBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpsertBulk) Ignore

func (u *UserUpsertBulk) Ignore() *UserUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.User.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*UserUpsertBulk) SetActive

func (u *UserUpsertBulk) SetActive(v bool) *UserUpsertBulk

SetActive sets the "active" field.

func (*UserUpsertBulk) SetAvatarImageID

func (u *UserUpsertBulk) SetAvatarImageID(v int) *UserUpsertBulk

SetAvatarImageID sets the "avatar_image_id" field.

func (*UserUpsertBulk) SetBio

func (u *UserUpsertBulk) SetBio(v string) *UserUpsertBulk

SetBio sets the "bio" field.

func (*UserUpsertBulk) SetBioHTML

func (u *UserUpsertBulk) SetBioHTML(v string) *UserUpsertBulk

SetBioHTML sets the "bio_html" field.

func (*UserUpsertBulk) SetCreatedAt

func (u *UserUpsertBulk) SetCreatedAt(v time.Time) *UserUpsertBulk

SetCreatedAt sets the "created_at" field.

func (*UserUpsertBulk) SetDeletedAt

func (u *UserUpsertBulk) SetDeletedAt(v time.Time) *UserUpsertBulk

SetDeletedAt sets the "deleted_at" field.

func (*UserUpsertBulk) SetDisplayName

func (u *UserUpsertBulk) SetDisplayName(v string) *UserUpsertBulk

SetDisplayName sets the "display_name" field.

func (*UserUpsertBulk) SetEmail

func (u *UserUpsertBulk) SetEmail(v string) *UserUpsertBulk

SetEmail sets the "email" field.

func (*UserUpsertBulk) SetPassword

func (u *UserUpsertBulk) SetPassword(v string) *UserUpsertBulk

SetPassword sets the "password" field.

func (*UserUpsertBulk) SetProvider

func (u *UserUpsertBulk) SetProvider(v string) *UserUpsertBulk

SetProvider sets the "provider" field.

func (*UserUpsertBulk) SetProviderAvatar

func (u *UserUpsertBulk) SetProviderAvatar(v string) *UserUpsertBulk

SetProviderAvatar sets the "provider_avatar" field.

func (*UserUpsertBulk) SetProviderID

func (u *UserUpsertBulk) SetProviderID(v string) *UserUpsertBulk

SetProviderID sets the "provider_id" field.

func (*UserUpsertBulk) SetProviderUsername

func (u *UserUpsertBulk) SetProviderUsername(v string) *UserUpsertBulk

SetProviderUsername sets the "provider_username" field.

func (*UserUpsertBulk) SetURL

func (u *UserUpsertBulk) SetURL(v string) *UserUpsertBulk

SetURL sets the "url" field.

func (*UserUpsertBulk) SetUpdatedAt

func (u *UserUpsertBulk) SetUpdatedAt(v time.Time) *UserUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsertBulk) SetUsername

func (u *UserUpsertBulk) SetUsername(v string) *UserUpsertBulk

SetUsername sets the "username" field.

func (*UserUpsertBulk) Update

func (u *UserUpsertBulk) Update(set func(*UserUpsert)) *UserUpsertBulk

Update allows overriding fields `UPDATE` values. See the UserCreateBulk.OnConflict documentation for more info.

func (*UserUpsertBulk) UpdateActive

func (u *UserUpsertBulk) UpdateActive() *UserUpsertBulk

UpdateActive sets the "active" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateAvatarImageID

func (u *UserUpsertBulk) UpdateAvatarImageID() *UserUpsertBulk

UpdateAvatarImageID sets the "avatar_image_id" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateBio

func (u *UserUpsertBulk) UpdateBio() *UserUpsertBulk

UpdateBio sets the "bio" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateBioHTML

func (u *UserUpsertBulk) UpdateBioHTML() *UserUpsertBulk

UpdateBioHTML sets the "bio_html" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateCreatedAt

func (u *UserUpsertBulk) UpdateCreatedAt() *UserUpsertBulk

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateDeletedAt

func (u *UserUpsertBulk) UpdateDeletedAt() *UserUpsertBulk

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateDisplayName

func (u *UserUpsertBulk) UpdateDisplayName() *UserUpsertBulk

UpdateDisplayName sets the "display_name" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateEmail

func (u *UserUpsertBulk) UpdateEmail() *UserUpsertBulk

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateNewValues

func (u *UserUpsertBulk) UpdateNewValues() *UserUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.User.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*UserUpsertBulk) UpdatePassword

func (u *UserUpsertBulk) UpdatePassword() *UserUpsertBulk

UpdatePassword sets the "password" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateProvider

func (u *UserUpsertBulk) UpdateProvider() *UserUpsertBulk

UpdateProvider sets the "provider" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateProviderAvatar

func (u *UserUpsertBulk) UpdateProviderAvatar() *UserUpsertBulk

UpdateProviderAvatar sets the "provider_avatar" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateProviderID

func (u *UserUpsertBulk) UpdateProviderID() *UserUpsertBulk

UpdateProviderID sets the "provider_id" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateProviderUsername

func (u *UserUpsertBulk) UpdateProviderUsername() *UserUpsertBulk

UpdateProviderUsername sets the "provider_username" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateURL

func (u *UserUpsertBulk) UpdateURL() *UserUpsertBulk

UpdateURL sets the "url" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateUpdatedAt

func (u *UserUpsertBulk) UpdateUpdatedAt() *UserUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateUsername

func (u *UserUpsertBulk) UpdateUsername() *UserUpsertBulk

UpdateUsername sets the "username" field to the value that was provided on create.

type UserUpsertOne

type UserUpsertOne struct {
	// contains filtered or unexported fields
}

UserUpsertOne is the builder for "upsert"-ing

one User node.

func (*UserUpsertOne) ClearAvatarImageID

func (u *UserUpsertOne) ClearAvatarImageID() *UserUpsertOne

ClearAvatarImageID clears the value of the "avatar_image_id" field.

func (*UserUpsertOne) ClearBio

func (u *UserUpsertOne) ClearBio() *UserUpsertOne

ClearBio clears the value of the "bio" field.

func (*UserUpsertOne) ClearBioHTML

func (u *UserUpsertOne) ClearBioHTML() *UserUpsertOne

ClearBioHTML clears the value of the "bio_html" field.

func (*UserUpsertOne) ClearDeletedAt

func (u *UserUpsertOne) ClearDeletedAt() *UserUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*UserUpsertOne) ClearDisplayName

func (u *UserUpsertOne) ClearDisplayName() *UserUpsertOne

ClearDisplayName clears the value of the "display_name" field.

func (*UserUpsertOne) ClearEmail

func (u *UserUpsertOne) ClearEmail() *UserUpsertOne

ClearEmail clears the value of the "email" field.

func (*UserUpsertOne) ClearPassword

func (u *UserUpsertOne) ClearPassword() *UserUpsertOne

ClearPassword clears the value of the "password" field.

func (*UserUpsertOne) ClearProvider

func (u *UserUpsertOne) ClearProvider() *UserUpsertOne

ClearProvider clears the value of the "provider" field.

func (*UserUpsertOne) ClearProviderAvatar

func (u *UserUpsertOne) ClearProviderAvatar() *UserUpsertOne

ClearProviderAvatar clears the value of the "provider_avatar" field.

func (*UserUpsertOne) ClearProviderID

func (u *UserUpsertOne) ClearProviderID() *UserUpsertOne

ClearProviderID clears the value of the "provider_id" field.

func (*UserUpsertOne) ClearProviderUsername

func (u *UserUpsertOne) ClearProviderUsername() *UserUpsertOne

ClearProviderUsername clears the value of the "provider_username" field.

func (*UserUpsertOne) ClearURL

func (u *UserUpsertOne) ClearURL() *UserUpsertOne

ClearURL clears the value of the "url" field.

func (*UserUpsertOne) DoNothing

func (u *UserUpsertOne) DoNothing() *UserUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserUpsertOne) Exec

func (u *UserUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpsertOne) ExecX

func (u *UserUpsertOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpsertOne) ID

func (u *UserUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*UserUpsertOne) IDX

func (u *UserUpsertOne) IDX(ctx context.Context) int

IDX is like ID, but panics if an error occurs.

func (*UserUpsertOne) Ignore

func (u *UserUpsertOne) Ignore() *UserUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.User.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*UserUpsertOne) SetActive

func (u *UserUpsertOne) SetActive(v bool) *UserUpsertOne

SetActive sets the "active" field.

func (*UserUpsertOne) SetAvatarImageID

func (u *UserUpsertOne) SetAvatarImageID(v int) *UserUpsertOne

SetAvatarImageID sets the "avatar_image_id" field.

func (*UserUpsertOne) SetBio

func (u *UserUpsertOne) SetBio(v string) *UserUpsertOne

SetBio sets the "bio" field.

func (*UserUpsertOne) SetBioHTML

func (u *UserUpsertOne) SetBioHTML(v string) *UserUpsertOne

SetBioHTML sets the "bio_html" field.

func (*UserUpsertOne) SetCreatedAt

func (u *UserUpsertOne) SetCreatedAt(v time.Time) *UserUpsertOne

SetCreatedAt sets the "created_at" field.

func (*UserUpsertOne) SetDeletedAt

func (u *UserUpsertOne) SetDeletedAt(v time.Time) *UserUpsertOne

SetDeletedAt sets the "deleted_at" field.

func (*UserUpsertOne) SetDisplayName

func (u *UserUpsertOne) SetDisplayName(v string) *UserUpsertOne

SetDisplayName sets the "display_name" field.

func (*UserUpsertOne) SetEmail

func (u *UserUpsertOne) SetEmail(v string) *UserUpsertOne

SetEmail sets the "email" field.

func (*UserUpsertOne) SetPassword

func (u *UserUpsertOne) SetPassword(v string) *UserUpsertOne

SetPassword sets the "password" field.

func (*UserUpsertOne) SetProvider

func (u *UserUpsertOne) SetProvider(v string) *UserUpsertOne

SetProvider sets the "provider" field.

func (*UserUpsertOne) SetProviderAvatar

func (u *UserUpsertOne) SetProviderAvatar(v string) *UserUpsertOne

SetProviderAvatar sets the "provider_avatar" field.

func (*UserUpsertOne) SetProviderID

func (u *UserUpsertOne) SetProviderID(v string) *UserUpsertOne

SetProviderID sets the "provider_id" field.

func (*UserUpsertOne) SetProviderUsername

func (u *UserUpsertOne) SetProviderUsername(v string) *UserUpsertOne

SetProviderUsername sets the "provider_username" field.

func (*UserUpsertOne) SetURL

func (u *UserUpsertOne) SetURL(v string) *UserUpsertOne

SetURL sets the "url" field.

func (*UserUpsertOne) SetUpdatedAt

func (u *UserUpsertOne) SetUpdatedAt(v time.Time) *UserUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsertOne) SetUsername

func (u *UserUpsertOne) SetUsername(v string) *UserUpsertOne

SetUsername sets the "username" field.

func (*UserUpsertOne) Update

func (u *UserUpsertOne) Update(set func(*UserUpsert)) *UserUpsertOne

Update allows overriding fields `UPDATE` values. See the UserCreate.OnConflict documentation for more info.

func (*UserUpsertOne) UpdateActive

func (u *UserUpsertOne) UpdateActive() *UserUpsertOne

UpdateActive sets the "active" field to the value that was provided on create.

func (*UserUpsertOne) UpdateAvatarImageID

func (u *UserUpsertOne) UpdateAvatarImageID() *UserUpsertOne

UpdateAvatarImageID sets the "avatar_image_id" field to the value that was provided on create.

func (*UserUpsertOne) UpdateBio

func (u *UserUpsertOne) UpdateBio() *UserUpsertOne

UpdateBio sets the "bio" field to the value that was provided on create.

func (*UserUpsertOne) UpdateBioHTML

func (u *UserUpsertOne) UpdateBioHTML() *UserUpsertOne

UpdateBioHTML sets the "bio_html" field to the value that was provided on create.

func (*UserUpsertOne) UpdateCreatedAt

func (u *UserUpsertOne) UpdateCreatedAt() *UserUpsertOne

UpdateCreatedAt sets the "created_at" field to the value that was provided on create.

func (*UserUpsertOne) UpdateDeletedAt

func (u *UserUpsertOne) UpdateDeletedAt() *UserUpsertOne

UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.

func (*UserUpsertOne) UpdateDisplayName

func (u *UserUpsertOne) UpdateDisplayName() *UserUpsertOne

UpdateDisplayName sets the "display_name" field to the value that was provided on create.

func (*UserUpsertOne) UpdateEmail

func (u *UserUpsertOne) UpdateEmail() *UserUpsertOne

UpdateEmail sets the "email" field to the value that was provided on create.

func (*UserUpsertOne) UpdateNewValues

func (u *UserUpsertOne) UpdateNewValues() *UserUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.User.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*UserUpsertOne) UpdatePassword

func (u *UserUpsertOne) UpdatePassword() *UserUpsertOne

UpdatePassword sets the "password" field to the value that was provided on create.

func (*UserUpsertOne) UpdateProvider

func (u *UserUpsertOne) UpdateProvider() *UserUpsertOne

UpdateProvider sets the "provider" field to the value that was provided on create.

func (*UserUpsertOne) UpdateProviderAvatar

func (u *UserUpsertOne) UpdateProviderAvatar() *UserUpsertOne

UpdateProviderAvatar sets the "provider_avatar" field to the value that was provided on create.

func (*UserUpsertOne) UpdateProviderID

func (u *UserUpsertOne) UpdateProviderID() *UserUpsertOne

UpdateProviderID sets the "provider_id" field to the value that was provided on create.

func (*UserUpsertOne) UpdateProviderUsername

func (u *UserUpsertOne) UpdateProviderUsername() *UserUpsertOne

UpdateProviderUsername sets the "provider_username" field to the value that was provided on create.

func (*UserUpsertOne) UpdateURL

func (u *UserUpsertOne) UpdateURL() *UserUpsertOne

UpdateURL sets the "url" field to the value that was provided on create.

func (*UserUpsertOne) UpdateUpdatedAt

func (u *UserUpsertOne) UpdateUpdatedAt() *UserUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

func (*UserUpsertOne) UpdateUsername

func (u *UserUpsertOne) UpdateUsername() *UserUpsertOne

UpdateUsername sets the "username" field to the value that was provided on create.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL