ent

package
v0.0.0-...-6f95374 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

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

	// Node types.
	TypeArticle     = "Article"
	TypeArticleTag  = "ArticleTag"
	TypeUser        = "User"
	TypeUserArticle = "UserArticle"
)

Variables

This section is empty.

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Article

type Article struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// URL holds the value of the "url" field.
	URL string `json:"url,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// Thumbnail holds the value of the "thumbnail" field.
	Thumbnail string `json:"thumbnail,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ArticleQuery when eager-loading is set.
	Edges ArticleEdges `json:"edges"`
	// contains filtered or unexported fields
}

Article is the model entity for the Article schema.

func (*Article) ExecContext

func (c *Article) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*Article) QueryContext

func (c *Article) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*Article) QueryTags

func (a *Article) QueryTags() *ArticleTagQuery

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

func (*Article) QueryUserArticles

func (a *Article) QueryUserArticles() *UserArticleQuery

QueryUserArticles queries the "user_articles" edge of the Article entity.

func (*Article) String

func (a *Article) String() string

String implements the fmt.Stringer.

func (*Article) Unwrap

func (a *Article) Unwrap() *Article

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

func (a *Article) Update() *ArticleUpdateOne

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

func (*Article) Value

func (a *Article) Value(name string) (ent.Value, error)

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

type ArticleClient

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

ArticleClient is a client for the Article schema.

func NewArticleClient

func NewArticleClient(c config) *ArticleClient

NewArticleClient returns a client for the Article from the given config.

func (*ArticleClient) Create

func (c *ArticleClient) Create() *ArticleCreate

Create returns a builder for creating a Article entity.

func (*ArticleClient) CreateBulk

func (c *ArticleClient) CreateBulk(builders ...*ArticleCreate) *ArticleCreateBulk

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

func (*ArticleClient) Delete

func (c *ArticleClient) Delete() *ArticleDelete

Delete returns a delete builder for Article.

func (*ArticleClient) DeleteOne

func (c *ArticleClient) DeleteOne(a *Article) *ArticleDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ArticleClient) DeleteOneID

func (c *ArticleClient) DeleteOneID(id uuid.UUID) *ArticleDeleteOne

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

func (*ArticleClient) ExecContext

func (c *ArticleClient) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleClient) Get

func (c *ArticleClient) Get(ctx context.Context, id uuid.UUID) (*Article, error)

Get returns a Article entity by its id.

func (*ArticleClient) GetX

func (c *ArticleClient) GetX(ctx context.Context, id uuid.UUID) *Article

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

func (*ArticleClient) Hooks

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

Hooks returns the client hooks.

func (*ArticleClient) Intercept

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

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

func (*ArticleClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ArticleClient) Query

func (c *ArticleClient) Query() *ArticleQuery

Query returns a query builder for Article.

func (*ArticleClient) QueryContext

func (c *ArticleClient) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleClient) QueryTags

func (c *ArticleClient) QueryTags(a *Article) *ArticleTagQuery

QueryTags queries the tags edge of a Article.

func (*ArticleClient) QueryUserArticles

func (c *ArticleClient) QueryUserArticles(a *Article) *UserArticleQuery

QueryUserArticles queries the user_articles edge of a Article.

func (*ArticleClient) Update

func (c *ArticleClient) Update() *ArticleUpdate

Update returns an update builder for Article.

func (*ArticleClient) UpdateOne

func (c *ArticleClient) UpdateOne(a *Article) *ArticleUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ArticleClient) UpdateOneID

func (c *ArticleClient) UpdateOneID(id uuid.UUID) *ArticleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ArticleClient) Use

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

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

type ArticleCreate

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

ArticleCreate is the builder for creating a Article entity.

func (*ArticleCreate) AddTagIDs

func (ac *ArticleCreate) AddTagIDs(ids ...uuid.UUID) *ArticleCreate

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

func (*ArticleCreate) AddTags

func (ac *ArticleCreate) AddTags(a ...*ArticleTag) *ArticleCreate

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

func (*ArticleCreate) AddUserArticleIDs

func (ac *ArticleCreate) AddUserArticleIDs(ids ...uuid.UUID) *ArticleCreate

AddUserArticleIDs adds the "user_articles" edge to the UserArticle entity by IDs.

func (*ArticleCreate) AddUserArticles

func (ac *ArticleCreate) AddUserArticles(u ...*UserArticle) *ArticleCreate

AddUserArticles adds the "user_articles" edges to the UserArticle entity.

func (*ArticleCreate) Exec

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

Exec executes the query.

func (*ArticleCreate) ExecContext

func (c *ArticleCreate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleCreate) ExecX

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

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

func (*ArticleCreate) Mutation

func (ac *ArticleCreate) Mutation() *ArticleMutation

Mutation returns the ArticleMutation object of the builder.

func (*ArticleCreate) OnConflict

func (ac *ArticleCreate) OnConflict(opts ...sql.ConflictOption) *ArticleUpsertOne

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

client.Article.Create().
	SetTitle(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.ArticleUpsert) {
		SetTitle(v+v).
	}).
	Exec(ctx)

func (*ArticleCreate) OnConflictColumns

func (ac *ArticleCreate) OnConflictColumns(columns ...string) *ArticleUpsertOne

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

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

func (*ArticleCreate) QueryContext

func (c *ArticleCreate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleCreate) Save

func (ac *ArticleCreate) Save(ctx context.Context) (*Article, error)

Save creates the Article in the database.

func (*ArticleCreate) SaveX

func (ac *ArticleCreate) SaveX(ctx context.Context) *Article

SaveX calls Save and panics if Save returns an error.

func (*ArticleCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ArticleCreate) SetDescription

func (ac *ArticleCreate) SetDescription(s string) *ArticleCreate

SetDescription sets the "description" field.

func (*ArticleCreate) SetID

func (ac *ArticleCreate) SetID(u uuid.UUID) *ArticleCreate

SetID sets the "id" field.

func (*ArticleCreate) SetNillableCreatedAt

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

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

func (*ArticleCreate) SetNillableID

func (ac *ArticleCreate) SetNillableID(u *uuid.UUID) *ArticleCreate

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

func (*ArticleCreate) SetNillableUpdatedAt

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

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

func (*ArticleCreate) SetThumbnail

func (ac *ArticleCreate) SetThumbnail(s string) *ArticleCreate

SetThumbnail sets the "thumbnail" field.

func (*ArticleCreate) SetTitle

func (ac *ArticleCreate) SetTitle(s string) *ArticleCreate

SetTitle sets the "title" field.

func (*ArticleCreate) SetURL

func (ac *ArticleCreate) SetURL(s string) *ArticleCreate

SetURL sets the "url" field.

func (*ArticleCreate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

type ArticleCreateBulk

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

ArticleCreateBulk is the builder for creating many Article entities in bulk.

func (*ArticleCreateBulk) Exec

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

Exec executes the query.

func (*ArticleCreateBulk) ExecContext

func (c *ArticleCreateBulk) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleCreateBulk) ExecX

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

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

func (*ArticleCreateBulk) OnConflict

func (acb *ArticleCreateBulk) OnConflict(opts ...sql.ConflictOption) *ArticleUpsertBulk

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

client.Article.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.ArticleUpsert) {
		SetTitle(v+v).
	}).
	Exec(ctx)

func (*ArticleCreateBulk) OnConflictColumns

func (acb *ArticleCreateBulk) OnConflictColumns(columns ...string) *ArticleUpsertBulk

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

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

func (*ArticleCreateBulk) QueryContext

func (c *ArticleCreateBulk) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleCreateBulk) Save

func (acb *ArticleCreateBulk) Save(ctx context.Context) ([]*Article, error)

Save creates the Article entities in the database.

func (*ArticleCreateBulk) SaveX

func (acb *ArticleCreateBulk) SaveX(ctx context.Context) []*Article

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

type ArticleDelete

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

ArticleDelete is the builder for deleting a Article entity.

func (*ArticleDelete) Exec

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

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

func (*ArticleDelete) ExecContext

func (c *ArticleDelete) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleDelete) ExecX

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

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

func (*ArticleDelete) QueryContext

func (c *ArticleDelete) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleDelete) Where

func (ad *ArticleDelete) Where(ps ...predicate.Article) *ArticleDelete

Where appends a list predicates to the ArticleDelete builder.

type ArticleDeleteOne

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

ArticleDeleteOne is the builder for deleting a single Article entity.

func (*ArticleDeleteOne) Exec

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

Exec executes the deletion query.

func (*ArticleDeleteOne) ExecX

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

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

func (*ArticleDeleteOne) Where

Where appends a list predicates to the ArticleDelete builder.

type ArticleEdges

type ArticleEdges struct {
	// Tags holds the value of the tags edge.
	Tags []*ArticleTag `json:"tags,omitempty"`
	// UserArticles holds the value of the user_articles edge.
	UserArticles []*UserArticle `json:"user_articles,omitempty"`
	// contains filtered or unexported fields
}

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

func (ArticleEdges) TagsOrErr

func (e ArticleEdges) TagsOrErr() ([]*ArticleTag, error)

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

func (ArticleEdges) UserArticlesOrErr

func (e ArticleEdges) UserArticlesOrErr() ([]*UserArticle, error)

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

type ArticleGroupBy

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

ArticleGroupBy is the group-by builder for Article entities.

func (*ArticleGroupBy) Aggregate

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

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

func (*ArticleGroupBy) Bool

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

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

func (*ArticleGroupBy) BoolX

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

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

func (*ArticleGroupBy) Bools

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

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

func (*ArticleGroupBy) BoolsX

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

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

func (*ArticleGroupBy) Float64

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

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

func (*ArticleGroupBy) Float64X

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

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

func (*ArticleGroupBy) Float64s

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

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

func (*ArticleGroupBy) Float64sX

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

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

func (*ArticleGroupBy) Int

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

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

func (*ArticleGroupBy) IntX

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

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

func (*ArticleGroupBy) Ints

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

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

func (*ArticleGroupBy) IntsX

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

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

func (*ArticleGroupBy) Scan

func (agb *ArticleGroupBy) Scan(ctx context.Context, v any) error

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

func (*ArticleGroupBy) ScanX

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

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

func (*ArticleGroupBy) String

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

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

func (*ArticleGroupBy) StringX

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

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

func (*ArticleGroupBy) Strings

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

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

func (*ArticleGroupBy) StringsX

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

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

type ArticleMutation

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

ArticleMutation represents an operation that mutates the Article nodes in the graph.

func (*ArticleMutation) AddField

func (m *ArticleMutation) 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 (*ArticleMutation) AddTagIDs

func (m *ArticleMutation) AddTagIDs(ids ...uuid.UUID)

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

func (*ArticleMutation) AddUserArticleIDs

func (m *ArticleMutation) AddUserArticleIDs(ids ...uuid.UUID)

AddUserArticleIDs adds the "user_articles" edge to the UserArticle entity by ids.

func (*ArticleMutation) AddedEdges

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

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

func (*ArticleMutation) AddedField

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

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

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

func (*ArticleMutation) AddedIDs

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

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

func (*ArticleMutation) ClearEdge

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

func (m *ArticleMutation) 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 (*ArticleMutation) ClearTags

func (m *ArticleMutation) ClearTags()

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

func (*ArticleMutation) ClearUserArticles

func (m *ArticleMutation) ClearUserArticles()

ClearUserArticles clears the "user_articles" edge to the UserArticle entity.

func (*ArticleMutation) ClearedEdges

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

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

func (*ArticleMutation) ClearedFields

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

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

func (ArticleMutation) Client

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

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

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

func (*ArticleMutation) Description

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

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

func (*ArticleMutation) EdgeCleared

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

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

func (*ArticleMutation) ExecContext

func (c *ArticleMutation) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleMutation) Field

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

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

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

func (*ArticleMutation) Fields

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

func (m *ArticleMutation) ID() (id uuid.UUID, 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 (*ArticleMutation) IDs

func (m *ArticleMutation) IDs(ctx context.Context) ([]uuid.UUID, 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 (*ArticleMutation) OldCreatedAt

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

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

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

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

func (m *ArticleMutation) 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 (*ArticleMutation) OldThumbnail

func (m *ArticleMutation) OldThumbnail(ctx context.Context) (v string, err error)

OldThumbnail returns the old "thumbnail" field's value of the Article entity. If the Article 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 (*ArticleMutation) OldTitle

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

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

func (m *ArticleMutation) OldURL(ctx context.Context) (v string, err error)

OldURL returns the old "url" field's value of the Article entity. If the Article 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 (*ArticleMutation) OldUpdatedAt

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

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

func (m *ArticleMutation) Op() Op

Op returns the operation name.

func (*ArticleMutation) QueryContext

func (c *ArticleMutation) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleMutation) RemoveTagIDs

func (m *ArticleMutation) RemoveTagIDs(ids ...uuid.UUID)

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

func (*ArticleMutation) RemoveUserArticleIDs

func (m *ArticleMutation) RemoveUserArticleIDs(ids ...uuid.UUID)

RemoveUserArticleIDs removes the "user_articles" edge to the UserArticle entity by IDs.

func (*ArticleMutation) RemovedEdges

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

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

func (*ArticleMutation) RemovedIDs

func (m *ArticleMutation) 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 (*ArticleMutation) RemovedTagsIDs

func (m *ArticleMutation) RemovedTagsIDs() (ids []uuid.UUID)

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

func (*ArticleMutation) RemovedUserArticlesIDs

func (m *ArticleMutation) RemovedUserArticlesIDs() (ids []uuid.UUID)

RemovedUserArticles returns the removed IDs of the "user_articles" edge to the UserArticle entity.

func (*ArticleMutation) ResetCreatedAt

func (m *ArticleMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ArticleMutation) ResetDescription

func (m *ArticleMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*ArticleMutation) ResetEdge

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

func (m *ArticleMutation) 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 (*ArticleMutation) ResetTags

func (m *ArticleMutation) ResetTags()

ResetTags resets all changes to the "tags" edge.

func (*ArticleMutation) ResetThumbnail

func (m *ArticleMutation) ResetThumbnail()

ResetThumbnail resets all changes to the "thumbnail" field.

func (*ArticleMutation) ResetTitle

func (m *ArticleMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*ArticleMutation) ResetURL

func (m *ArticleMutation) ResetURL()

ResetURL resets all changes to the "url" field.

func (*ArticleMutation) ResetUpdatedAt

func (m *ArticleMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*ArticleMutation) ResetUserArticles

func (m *ArticleMutation) ResetUserArticles()

ResetUserArticles resets all changes to the "user_articles" edge.

func (*ArticleMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ArticleMutation) SetDescription

func (m *ArticleMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*ArticleMutation) SetField

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

func (m *ArticleMutation) SetID(id uuid.UUID)

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

func (*ArticleMutation) SetOp

func (m *ArticleMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ArticleMutation) SetThumbnail

func (m *ArticleMutation) SetThumbnail(s string)

SetThumbnail sets the "thumbnail" field.

func (*ArticleMutation) SetTitle

func (m *ArticleMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*ArticleMutation) SetURL

func (m *ArticleMutation) SetURL(s string)

SetURL sets the "url" field.

func (*ArticleMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*ArticleMutation) TagsCleared

func (m *ArticleMutation) TagsCleared() bool

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

func (*ArticleMutation) TagsIDs

func (m *ArticleMutation) TagsIDs() (ids []uuid.UUID)

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

func (*ArticleMutation) Thumbnail

func (m *ArticleMutation) Thumbnail() (r string, exists bool)

Thumbnail returns the value of the "thumbnail" field in the mutation.

func (*ArticleMutation) Title

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

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

func (ArticleMutation) Tx

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

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

func (*ArticleMutation) Type

func (m *ArticleMutation) Type() string

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

func (*ArticleMutation) URL

func (m *ArticleMutation) URL() (r string, exists bool)

URL returns the value of the "url" field in the mutation.

func (*ArticleMutation) UpdatedAt

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

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

func (*ArticleMutation) UserArticlesCleared

func (m *ArticleMutation) UserArticlesCleared() bool

UserArticlesCleared reports if the "user_articles" edge to the UserArticle entity was cleared.

func (*ArticleMutation) UserArticlesIDs

func (m *ArticleMutation) UserArticlesIDs() (ids []uuid.UUID)

UserArticlesIDs returns the "user_articles" edge IDs in the mutation.

func (*ArticleMutation) Where

func (m *ArticleMutation) Where(ps ...predicate.Article)

Where appends a list predicates to the ArticleMutation builder.

func (*ArticleMutation) WhereP

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

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

type ArticleQuery

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

ArticleQuery is the builder for querying Article entities.

func (*ArticleQuery) Aggregate

func (aq *ArticleQuery) Aggregate(fns ...AggregateFunc) *ArticleSelect

Aggregate returns a ArticleSelect configured with the given aggregations.

func (*ArticleQuery) All

func (aq *ArticleQuery) All(ctx context.Context) ([]*Article, error)

All executes the query and returns a list of Articles.

func (*ArticleQuery) AllX

func (aq *ArticleQuery) AllX(ctx context.Context) []*Article

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

func (*ArticleQuery) Clone

func (aq *ArticleQuery) Clone() *ArticleQuery

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

func (*ArticleQuery) Count

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

Count returns the count of the given query.

func (*ArticleQuery) CountX

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

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

func (*ArticleQuery) ExecContext

func (c *ArticleQuery) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleQuery) Exist

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

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

func (*ArticleQuery) ExistX

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

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

func (*ArticleQuery) First

func (aq *ArticleQuery) First(ctx context.Context) (*Article, error)

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

func (*ArticleQuery) FirstID

func (aq *ArticleQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ArticleQuery) FirstIDX

func (aq *ArticleQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*ArticleQuery) FirstX

func (aq *ArticleQuery) FirstX(ctx context.Context) *Article

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

func (*ArticleQuery) ForShare

func (aq *ArticleQuery) ForShare(opts ...sql.LockOption) *ArticleQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*ArticleQuery) ForUpdate

func (aq *ArticleQuery) ForUpdate(opts ...sql.LockOption) *ArticleQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*ArticleQuery) GroupBy

func (aq *ArticleQuery) GroupBy(field string, fields ...string) *ArticleGroupBy

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

client.Article.Query().
	GroupBy(article.FieldTitle).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ArticleQuery) IDs

func (aq *ArticleQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*ArticleQuery) IDsX

func (aq *ArticleQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*ArticleQuery) Limit

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

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

func (*ArticleQuery) Offset

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

Offset to start from.

func (*ArticleQuery) Only

func (aq *ArticleQuery) Only(ctx context.Context) (*Article, error)

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

func (*ArticleQuery) OnlyID

func (aq *ArticleQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ArticleQuery) OnlyIDX

func (aq *ArticleQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*ArticleQuery) OnlyX

func (aq *ArticleQuery) OnlyX(ctx context.Context) *Article

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

func (*ArticleQuery) Order

func (aq *ArticleQuery) Order(o ...article.OrderOption) *ArticleQuery

Order specifies how the records should be ordered.

func (*ArticleQuery) QueryContext

func (c *ArticleQuery) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleQuery) QueryTags

func (aq *ArticleQuery) QueryTags() *ArticleTagQuery

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

func (*ArticleQuery) QueryUserArticles

func (aq *ArticleQuery) QueryUserArticles() *UserArticleQuery

QueryUserArticles chains the current query on the "user_articles" edge.

func (*ArticleQuery) Select

func (aq *ArticleQuery) Select(fields ...string) *ArticleSelect

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

client.Article.Query().
	Select(article.FieldTitle).
	Scan(ctx, &v)

func (*ArticleQuery) Unique

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

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

func (aq *ArticleQuery) Where(ps ...predicate.Article) *ArticleQuery

Where adds a new predicate for the ArticleQuery builder.

func (*ArticleQuery) WithTags

func (aq *ArticleQuery) WithTags(opts ...func(*ArticleTagQuery)) *ArticleQuery

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

func (*ArticleQuery) WithUserArticles

func (aq *ArticleQuery) WithUserArticles(opts ...func(*UserArticleQuery)) *ArticleQuery

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

type ArticleSelect

type ArticleSelect struct {
	*ArticleQuery
	// contains filtered or unexported fields
}

ArticleSelect is the builder for selecting fields of Article entities.

func (*ArticleSelect) Aggregate

func (as *ArticleSelect) Aggregate(fns ...AggregateFunc) *ArticleSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ArticleSelect) Bool

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

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

func (*ArticleSelect) BoolX

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

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

func (*ArticleSelect) Bools

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

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

func (*ArticleSelect) BoolsX

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

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

func (ArticleSelect) ExecContext

func (c ArticleSelect) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleSelect) Float64

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

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

func (*ArticleSelect) Float64X

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

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

func (*ArticleSelect) Float64s

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

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

func (*ArticleSelect) Float64sX

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

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

func (*ArticleSelect) Int

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

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

func (*ArticleSelect) IntX

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

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

func (*ArticleSelect) Ints

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

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

func (*ArticleSelect) IntsX

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

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

func (ArticleSelect) QueryContext

func (c ArticleSelect) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleSelect) Scan

func (as *ArticleSelect) Scan(ctx context.Context, v any) error

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

func (*ArticleSelect) ScanX

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

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

func (*ArticleSelect) String

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

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

func (*ArticleSelect) StringX

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

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

func (*ArticleSelect) Strings

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

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

func (*ArticleSelect) StringsX

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

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

type ArticleTag

type ArticleTag struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Tag holds the value of the "tag" field.
	Tag string `json:"tag,omitempty"`
	// ArticleID holds the value of the "article_id" field.
	ArticleID uuid.UUID `json:"article_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ArticleTagQuery when eager-loading is set.
	Edges ArticleTagEdges `json:"edges"`
	// contains filtered or unexported fields
}

ArticleTag is the model entity for the ArticleTag schema.

func (*ArticleTag) ExecContext

func (c *ArticleTag) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleTag) QueryArticle

func (at *ArticleTag) QueryArticle() *ArticleQuery

QueryArticle queries the "article" edge of the ArticleTag entity.

func (*ArticleTag) QueryContext

func (c *ArticleTag) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleTag) String

func (at *ArticleTag) String() string

String implements the fmt.Stringer.

func (*ArticleTag) Unwrap

func (at *ArticleTag) Unwrap() *ArticleTag

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

func (at *ArticleTag) Update() *ArticleTagUpdateOne

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

func (*ArticleTag) Value

func (at *ArticleTag) Value(name string) (ent.Value, error)

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

type ArticleTagClient

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

ArticleTagClient is a client for the ArticleTag schema.

func NewArticleTagClient

func NewArticleTagClient(c config) *ArticleTagClient

NewArticleTagClient returns a client for the ArticleTag from the given config.

func (*ArticleTagClient) Create

func (c *ArticleTagClient) Create() *ArticleTagCreate

Create returns a builder for creating a ArticleTag entity.

func (*ArticleTagClient) CreateBulk

func (c *ArticleTagClient) CreateBulk(builders ...*ArticleTagCreate) *ArticleTagCreateBulk

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

func (*ArticleTagClient) Delete

func (c *ArticleTagClient) Delete() *ArticleTagDelete

Delete returns a delete builder for ArticleTag.

func (*ArticleTagClient) DeleteOne

func (c *ArticleTagClient) DeleteOne(at *ArticleTag) *ArticleTagDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ArticleTagClient) DeleteOneID

func (c *ArticleTagClient) DeleteOneID(id uuid.UUID) *ArticleTagDeleteOne

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

func (*ArticleTagClient) ExecContext

func (c *ArticleTagClient) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleTagClient) Get

Get returns a ArticleTag entity by its id.

func (*ArticleTagClient) GetX

func (c *ArticleTagClient) GetX(ctx context.Context, id uuid.UUID) *ArticleTag

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

func (*ArticleTagClient) Hooks

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

Hooks returns the client hooks.

func (*ArticleTagClient) Intercept

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

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

func (*ArticleTagClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ArticleTagClient) Query

func (c *ArticleTagClient) Query() *ArticleTagQuery

Query returns a query builder for ArticleTag.

func (*ArticleTagClient) QueryArticle

func (c *ArticleTagClient) QueryArticle(at *ArticleTag) *ArticleQuery

QueryArticle queries the article edge of a ArticleTag.

func (*ArticleTagClient) QueryContext

func (c *ArticleTagClient) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleTagClient) Update

func (c *ArticleTagClient) Update() *ArticleTagUpdate

Update returns an update builder for ArticleTag.

func (*ArticleTagClient) UpdateOne

func (c *ArticleTagClient) UpdateOne(at *ArticleTag) *ArticleTagUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ArticleTagClient) UpdateOneID

func (c *ArticleTagClient) UpdateOneID(id uuid.UUID) *ArticleTagUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ArticleTagClient) Use

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

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

type ArticleTagCreate

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

ArticleTagCreate is the builder for creating a ArticleTag entity.

func (*ArticleTagCreate) Exec

func (atc *ArticleTagCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ArticleTagCreate) ExecContext

func (c *ArticleTagCreate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleTagCreate) ExecX

func (atc *ArticleTagCreate) ExecX(ctx context.Context)

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

func (*ArticleTagCreate) Mutation

func (atc *ArticleTagCreate) Mutation() *ArticleTagMutation

Mutation returns the ArticleTagMutation object of the builder.

func (*ArticleTagCreate) OnConflict

func (atc *ArticleTagCreate) OnConflict(opts ...sql.ConflictOption) *ArticleTagUpsertOne

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

client.ArticleTag.Create().
	SetTag(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.ArticleTagUpsert) {
		SetTag(v+v).
	}).
	Exec(ctx)

func (*ArticleTagCreate) OnConflictColumns

func (atc *ArticleTagCreate) OnConflictColumns(columns ...string) *ArticleTagUpsertOne

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

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

func (*ArticleTagCreate) QueryContext

func (c *ArticleTagCreate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleTagCreate) Save

func (atc *ArticleTagCreate) Save(ctx context.Context) (*ArticleTag, error)

Save creates the ArticleTag in the database.

func (*ArticleTagCreate) SaveX

func (atc *ArticleTagCreate) SaveX(ctx context.Context) *ArticleTag

SaveX calls Save and panics if Save returns an error.

func (*ArticleTagCreate) SetArticle

func (atc *ArticleTagCreate) SetArticle(a *Article) *ArticleTagCreate

SetArticle sets the "article" edge to the Article entity.

func (*ArticleTagCreate) SetArticleID

func (atc *ArticleTagCreate) SetArticleID(u uuid.UUID) *ArticleTagCreate

SetArticleID sets the "article_id" field.

func (*ArticleTagCreate) SetID

func (atc *ArticleTagCreate) SetID(u uuid.UUID) *ArticleTagCreate

SetID sets the "id" field.

func (*ArticleTagCreate) SetNillableID

func (atc *ArticleTagCreate) SetNillableID(u *uuid.UUID) *ArticleTagCreate

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

func (*ArticleTagCreate) SetTag

func (atc *ArticleTagCreate) SetTag(s string) *ArticleTagCreate

SetTag sets the "tag" field.

type ArticleTagCreateBulk

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

ArticleTagCreateBulk is the builder for creating many ArticleTag entities in bulk.

func (*ArticleTagCreateBulk) Exec

func (atcb *ArticleTagCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ArticleTagCreateBulk) ExecContext

func (c *ArticleTagCreateBulk) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleTagCreateBulk) ExecX

func (atcb *ArticleTagCreateBulk) ExecX(ctx context.Context)

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

func (*ArticleTagCreateBulk) OnConflict

func (atcb *ArticleTagCreateBulk) OnConflict(opts ...sql.ConflictOption) *ArticleTagUpsertBulk

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

client.ArticleTag.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.ArticleTagUpsert) {
		SetTag(v+v).
	}).
	Exec(ctx)

func (*ArticleTagCreateBulk) OnConflictColumns

func (atcb *ArticleTagCreateBulk) OnConflictColumns(columns ...string) *ArticleTagUpsertBulk

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

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

func (*ArticleTagCreateBulk) QueryContext

func (c *ArticleTagCreateBulk) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleTagCreateBulk) Save

func (atcb *ArticleTagCreateBulk) Save(ctx context.Context) ([]*ArticleTag, error)

Save creates the ArticleTag entities in the database.

func (*ArticleTagCreateBulk) SaveX

func (atcb *ArticleTagCreateBulk) SaveX(ctx context.Context) []*ArticleTag

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

type ArticleTagDelete

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

ArticleTagDelete is the builder for deleting a ArticleTag entity.

func (*ArticleTagDelete) Exec

func (atd *ArticleTagDelete) Exec(ctx context.Context) (int, error)

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

func (*ArticleTagDelete) ExecContext

func (c *ArticleTagDelete) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleTagDelete) ExecX

func (atd *ArticleTagDelete) ExecX(ctx context.Context) int

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

func (*ArticleTagDelete) QueryContext

func (c *ArticleTagDelete) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleTagDelete) Where

Where appends a list predicates to the ArticleTagDelete builder.

type ArticleTagDeleteOne

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

ArticleTagDeleteOne is the builder for deleting a single ArticleTag entity.

func (*ArticleTagDeleteOne) Exec

func (atdo *ArticleTagDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ArticleTagDeleteOne) ExecX

func (atdo *ArticleTagDeleteOne) ExecX(ctx context.Context)

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

func (*ArticleTagDeleteOne) Where

Where appends a list predicates to the ArticleTagDelete builder.

type ArticleTagEdges

type ArticleTagEdges struct {
	// Article holds the value of the article edge.
	Article *Article `json:"article,omitempty"`
	// contains filtered or unexported fields
}

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

func (ArticleTagEdges) ArticleOrErr

func (e ArticleTagEdges) ArticleOrErr() (*Article, error)

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

type ArticleTagGroupBy

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

ArticleTagGroupBy is the group-by builder for ArticleTag entities.

func (*ArticleTagGroupBy) Aggregate

func (atgb *ArticleTagGroupBy) Aggregate(fns ...AggregateFunc) *ArticleTagGroupBy

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

func (*ArticleTagGroupBy) Bool

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

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

func (*ArticleTagGroupBy) BoolX

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

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

func (*ArticleTagGroupBy) Bools

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

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

func (*ArticleTagGroupBy) BoolsX

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

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

func (*ArticleTagGroupBy) Float64

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

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

func (*ArticleTagGroupBy) Float64X

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

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

func (*ArticleTagGroupBy) Float64s

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

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

func (*ArticleTagGroupBy) Float64sX

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

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

func (*ArticleTagGroupBy) Int

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

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

func (*ArticleTagGroupBy) IntX

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

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

func (*ArticleTagGroupBy) Ints

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

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

func (*ArticleTagGroupBy) IntsX

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

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

func (*ArticleTagGroupBy) Scan

func (atgb *ArticleTagGroupBy) Scan(ctx context.Context, v any) error

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

func (*ArticleTagGroupBy) ScanX

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

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

func (*ArticleTagGroupBy) String

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

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

func (*ArticleTagGroupBy) StringX

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

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

func (*ArticleTagGroupBy) Strings

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

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

func (*ArticleTagGroupBy) StringsX

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

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

type ArticleTagMutation

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

ArticleTagMutation represents an operation that mutates the ArticleTag nodes in the graph.

func (*ArticleTagMutation) AddField

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

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

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

func (*ArticleTagMutation) AddedField

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

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

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

func (*ArticleTagMutation) AddedIDs

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

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

func (*ArticleTagMutation) ArticleCleared

func (m *ArticleTagMutation) ArticleCleared() bool

ArticleCleared reports if the "article" edge to the Article entity was cleared.

func (*ArticleTagMutation) ArticleID

func (m *ArticleTagMutation) ArticleID() (r uuid.UUID, exists bool)

ArticleID returns the value of the "article_id" field in the mutation.

func (*ArticleTagMutation) ArticleIDs

func (m *ArticleTagMutation) ArticleIDs() (ids []uuid.UUID)

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

func (*ArticleTagMutation) ClearArticle

func (m *ArticleTagMutation) ClearArticle()

ClearArticle clears the "article" edge to the Article entity.

func (*ArticleTagMutation) ClearEdge

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

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

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

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

func (*ArticleTagMutation) ClearedFields

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

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

func (ArticleTagMutation) Client

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

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

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

func (*ArticleTagMutation) ExecContext

func (c *ArticleTagMutation) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleTagMutation) Field

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

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

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

func (*ArticleTagMutation) Fields

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

func (m *ArticleTagMutation) ID() (id uuid.UUID, 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 (*ArticleTagMutation) IDs

func (m *ArticleTagMutation) IDs(ctx context.Context) ([]uuid.UUID, 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 (*ArticleTagMutation) OldArticleID

func (m *ArticleTagMutation) OldArticleID(ctx context.Context) (v uuid.UUID, err error)

OldArticleID returns the old "article_id" field's value of the ArticleTag entity. If the ArticleTag 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 (*ArticleTagMutation) OldField

func (m *ArticleTagMutation) 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 (*ArticleTagMutation) OldTag

func (m *ArticleTagMutation) OldTag(ctx context.Context) (v string, err error)

OldTag returns the old "tag" field's value of the ArticleTag entity. If the ArticleTag 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 (*ArticleTagMutation) Op

func (m *ArticleTagMutation) Op() Op

Op returns the operation name.

func (*ArticleTagMutation) QueryContext

func (c *ArticleTagMutation) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleTagMutation) RemovedEdges

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

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

func (*ArticleTagMutation) RemovedIDs

func (m *ArticleTagMutation) 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 (*ArticleTagMutation) ResetArticle

func (m *ArticleTagMutation) ResetArticle()

ResetArticle resets all changes to the "article" edge.

func (*ArticleTagMutation) ResetArticleID

func (m *ArticleTagMutation) ResetArticleID()

ResetArticleID resets all changes to the "article_id" field.

func (*ArticleTagMutation) ResetEdge

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

func (m *ArticleTagMutation) 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 (*ArticleTagMutation) ResetTag

func (m *ArticleTagMutation) ResetTag()

ResetTag resets all changes to the "tag" field.

func (*ArticleTagMutation) SetArticleID

func (m *ArticleTagMutation) SetArticleID(u uuid.UUID)

SetArticleID sets the "article_id" field.

func (*ArticleTagMutation) SetField

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

func (m *ArticleTagMutation) SetID(id uuid.UUID)

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

func (*ArticleTagMutation) SetOp

func (m *ArticleTagMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ArticleTagMutation) SetTag

func (m *ArticleTagMutation) SetTag(s string)

SetTag sets the "tag" field.

func (*ArticleTagMutation) Tag

func (m *ArticleTagMutation) Tag() (r string, exists bool)

Tag returns the value of the "tag" field in the mutation.

func (ArticleTagMutation) Tx

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

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

func (*ArticleTagMutation) Type

func (m *ArticleTagMutation) Type() string

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

func (*ArticleTagMutation) Where

func (m *ArticleTagMutation) Where(ps ...predicate.ArticleTag)

Where appends a list predicates to the ArticleTagMutation builder.

func (*ArticleTagMutation) WhereP

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

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

type ArticleTagQuery

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

ArticleTagQuery is the builder for querying ArticleTag entities.

func (*ArticleTagQuery) Aggregate

func (atq *ArticleTagQuery) Aggregate(fns ...AggregateFunc) *ArticleTagSelect

Aggregate returns a ArticleTagSelect configured with the given aggregations.

func (*ArticleTagQuery) All

func (atq *ArticleTagQuery) All(ctx context.Context) ([]*ArticleTag, error)

All executes the query and returns a list of ArticleTags.

func (*ArticleTagQuery) AllX

func (atq *ArticleTagQuery) AllX(ctx context.Context) []*ArticleTag

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

func (*ArticleTagQuery) Clone

func (atq *ArticleTagQuery) Clone() *ArticleTagQuery

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

func (*ArticleTagQuery) Count

func (atq *ArticleTagQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ArticleTagQuery) CountX

func (atq *ArticleTagQuery) CountX(ctx context.Context) int

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

func (*ArticleTagQuery) ExecContext

func (c *ArticleTagQuery) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleTagQuery) Exist

func (atq *ArticleTagQuery) Exist(ctx context.Context) (bool, error)

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

func (*ArticleTagQuery) ExistX

func (atq *ArticleTagQuery) ExistX(ctx context.Context) bool

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

func (*ArticleTagQuery) First

func (atq *ArticleTagQuery) First(ctx context.Context) (*ArticleTag, error)

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

func (*ArticleTagQuery) FirstID

func (atq *ArticleTagQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ArticleTagQuery) FirstIDX

func (atq *ArticleTagQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*ArticleTagQuery) FirstX

func (atq *ArticleTagQuery) FirstX(ctx context.Context) *ArticleTag

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

func (*ArticleTagQuery) ForShare

func (atq *ArticleTagQuery) ForShare(opts ...sql.LockOption) *ArticleTagQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*ArticleTagQuery) ForUpdate

func (atq *ArticleTagQuery) ForUpdate(opts ...sql.LockOption) *ArticleTagQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*ArticleTagQuery) GroupBy

func (atq *ArticleTagQuery) GroupBy(field string, fields ...string) *ArticleTagGroupBy

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

client.ArticleTag.Query().
	GroupBy(articletag.FieldTag).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ArticleTagQuery) IDs

func (atq *ArticleTagQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*ArticleTagQuery) IDsX

func (atq *ArticleTagQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*ArticleTagQuery) Limit

func (atq *ArticleTagQuery) Limit(limit int) *ArticleTagQuery

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

func (*ArticleTagQuery) Offset

func (atq *ArticleTagQuery) Offset(offset int) *ArticleTagQuery

Offset to start from.

func (*ArticleTagQuery) Only

func (atq *ArticleTagQuery) Only(ctx context.Context) (*ArticleTag, error)

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

func (*ArticleTagQuery) OnlyID

func (atq *ArticleTagQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ArticleTagQuery) OnlyIDX

func (atq *ArticleTagQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*ArticleTagQuery) OnlyX

func (atq *ArticleTagQuery) OnlyX(ctx context.Context) *ArticleTag

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

func (*ArticleTagQuery) Order

Order specifies how the records should be ordered.

func (*ArticleTagQuery) QueryArticle

func (atq *ArticleTagQuery) QueryArticle() *ArticleQuery

QueryArticle chains the current query on the "article" edge.

func (*ArticleTagQuery) QueryContext

func (c *ArticleTagQuery) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleTagQuery) Select

func (atq *ArticleTagQuery) Select(fields ...string) *ArticleTagSelect

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

client.ArticleTag.Query().
	Select(articletag.FieldTag).
	Scan(ctx, &v)

func (*ArticleTagQuery) Unique

func (atq *ArticleTagQuery) Unique(unique bool) *ArticleTagQuery

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

Where adds a new predicate for the ArticleTagQuery builder.

func (*ArticleTagQuery) WithArticle

func (atq *ArticleTagQuery) WithArticle(opts ...func(*ArticleQuery)) *ArticleTagQuery

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

type ArticleTagSelect

type ArticleTagSelect struct {
	*ArticleTagQuery
	// contains filtered or unexported fields
}

ArticleTagSelect is the builder for selecting fields of ArticleTag entities.

func (*ArticleTagSelect) Aggregate

func (ats *ArticleTagSelect) Aggregate(fns ...AggregateFunc) *ArticleTagSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ArticleTagSelect) Bool

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

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

func (*ArticleTagSelect) BoolX

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

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

func (*ArticleTagSelect) Bools

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

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

func (*ArticleTagSelect) BoolsX

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

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

func (ArticleTagSelect) ExecContext

func (c ArticleTagSelect) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleTagSelect) Float64

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

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

func (*ArticleTagSelect) Float64X

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

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

func (*ArticleTagSelect) Float64s

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

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

func (*ArticleTagSelect) Float64sX

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

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

func (*ArticleTagSelect) Int

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

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

func (*ArticleTagSelect) IntX

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

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

func (*ArticleTagSelect) Ints

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

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

func (*ArticleTagSelect) IntsX

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

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

func (ArticleTagSelect) QueryContext

func (c ArticleTagSelect) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleTagSelect) Scan

func (ats *ArticleTagSelect) Scan(ctx context.Context, v any) error

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

func (*ArticleTagSelect) ScanX

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

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

func (*ArticleTagSelect) String

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

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

func (*ArticleTagSelect) StringX

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

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

func (*ArticleTagSelect) Strings

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

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

func (*ArticleTagSelect) StringsX

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

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

type ArticleTagUpdate

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

ArticleTagUpdate is the builder for updating ArticleTag entities.

func (*ArticleTagUpdate) ClearArticle

func (atu *ArticleTagUpdate) ClearArticle() *ArticleTagUpdate

ClearArticle clears the "article" edge to the Article entity.

func (*ArticleTagUpdate) Exec

func (atu *ArticleTagUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ArticleTagUpdate) ExecContext

func (c *ArticleTagUpdate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleTagUpdate) ExecX

func (atu *ArticleTagUpdate) ExecX(ctx context.Context)

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

func (*ArticleTagUpdate) Mutation

func (atu *ArticleTagUpdate) Mutation() *ArticleTagMutation

Mutation returns the ArticleTagMutation object of the builder.

func (*ArticleTagUpdate) QueryContext

func (c *ArticleTagUpdate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleTagUpdate) Save

func (atu *ArticleTagUpdate) Save(ctx context.Context) (int, error)

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

func (*ArticleTagUpdate) SaveX

func (atu *ArticleTagUpdate) SaveX(ctx context.Context) int

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

func (*ArticleTagUpdate) SetArticle

func (atu *ArticleTagUpdate) SetArticle(a *Article) *ArticleTagUpdate

SetArticle sets the "article" edge to the Article entity.

func (*ArticleTagUpdate) SetArticleID

func (atu *ArticleTagUpdate) SetArticleID(u uuid.UUID) *ArticleTagUpdate

SetArticleID sets the "article_id" field.

func (*ArticleTagUpdate) SetTag

func (atu *ArticleTagUpdate) SetTag(s string) *ArticleTagUpdate

SetTag sets the "tag" field.

func (*ArticleTagUpdate) Where

Where appends a list predicates to the ArticleTagUpdate builder.

type ArticleTagUpdateOne

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

ArticleTagUpdateOne is the builder for updating a single ArticleTag entity.

func (*ArticleTagUpdateOne) ClearArticle

func (atuo *ArticleTagUpdateOne) ClearArticle() *ArticleTagUpdateOne

ClearArticle clears the "article" edge to the Article entity.

func (*ArticleTagUpdateOne) Exec

func (atuo *ArticleTagUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ArticleTagUpdateOne) ExecContext

func (c *ArticleTagUpdateOne) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleTagUpdateOne) ExecX

func (atuo *ArticleTagUpdateOne) ExecX(ctx context.Context)

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

func (*ArticleTagUpdateOne) Mutation

func (atuo *ArticleTagUpdateOne) Mutation() *ArticleTagMutation

Mutation returns the ArticleTagMutation object of the builder.

func (*ArticleTagUpdateOne) QueryContext

func (c *ArticleTagUpdateOne) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleTagUpdateOne) Save

func (atuo *ArticleTagUpdateOne) Save(ctx context.Context) (*ArticleTag, error)

Save executes the query and returns the updated ArticleTag entity.

func (*ArticleTagUpdateOne) SaveX

func (atuo *ArticleTagUpdateOne) SaveX(ctx context.Context) *ArticleTag

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

func (*ArticleTagUpdateOne) Select

func (atuo *ArticleTagUpdateOne) Select(field string, fields ...string) *ArticleTagUpdateOne

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

func (*ArticleTagUpdateOne) SetArticle

func (atuo *ArticleTagUpdateOne) SetArticle(a *Article) *ArticleTagUpdateOne

SetArticle sets the "article" edge to the Article entity.

func (*ArticleTagUpdateOne) SetArticleID

func (atuo *ArticleTagUpdateOne) SetArticleID(u uuid.UUID) *ArticleTagUpdateOne

SetArticleID sets the "article_id" field.

func (*ArticleTagUpdateOne) SetTag

SetTag sets the "tag" field.

func (*ArticleTagUpdateOne) Where

Where appends a list predicates to the ArticleTagUpdate builder.

type ArticleTagUpsert

type ArticleTagUpsert struct {
	*sql.UpdateSet
}

ArticleTagUpsert is the "OnConflict" setter.

func (*ArticleTagUpsert) SetArticleID

func (u *ArticleTagUpsert) SetArticleID(v uuid.UUID) *ArticleTagUpsert

SetArticleID sets the "article_id" field.

func (*ArticleTagUpsert) SetTag

SetTag sets the "tag" field.

func (*ArticleTagUpsert) UpdateArticleID

func (u *ArticleTagUpsert) UpdateArticleID() *ArticleTagUpsert

UpdateArticleID sets the "article_id" field to the value that was provided on create.

func (*ArticleTagUpsert) UpdateTag

func (u *ArticleTagUpsert) UpdateTag() *ArticleTagUpsert

UpdateTag sets the "tag" field to the value that was provided on create.

type ArticleTagUpsertBulk

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

ArticleTagUpsertBulk is the builder for "upsert"-ing a bulk of ArticleTag nodes.

func (*ArticleTagUpsertBulk) DoNothing

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

func (*ArticleTagUpsertBulk) Exec

Exec executes the query.

func (*ArticleTagUpsertBulk) ExecX

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

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

func (*ArticleTagUpsertBulk) Ignore

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

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

func (*ArticleTagUpsertBulk) SetArticleID

func (u *ArticleTagUpsertBulk) SetArticleID(v uuid.UUID) *ArticleTagUpsertBulk

SetArticleID sets the "article_id" field.

func (*ArticleTagUpsertBulk) SetTag

SetTag sets the "tag" field.

func (*ArticleTagUpsertBulk) Update

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

func (*ArticleTagUpsertBulk) UpdateArticleID

func (u *ArticleTagUpsertBulk) UpdateArticleID() *ArticleTagUpsertBulk

UpdateArticleID sets the "article_id" field to the value that was provided on create.

func (*ArticleTagUpsertBulk) UpdateNewValues

func (u *ArticleTagUpsertBulk) UpdateNewValues() *ArticleTagUpsertBulk

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

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

func (*ArticleTagUpsertBulk) UpdateTag

UpdateTag sets the "tag" field to the value that was provided on create.

type ArticleTagUpsertOne

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

ArticleTagUpsertOne is the builder for "upsert"-ing

one ArticleTag node.

func (*ArticleTagUpsertOne) DoNothing

func (u *ArticleTagUpsertOne) DoNothing() *ArticleTagUpsertOne

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

func (*ArticleTagUpsertOne) Exec

Exec executes the query.

func (*ArticleTagUpsertOne) ExecX

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

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

func (*ArticleTagUpsertOne) ID

func (u *ArticleTagUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ArticleTagUpsertOne) IDX

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

func (*ArticleTagUpsertOne) Ignore

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

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

func (*ArticleTagUpsertOne) SetArticleID

func (u *ArticleTagUpsertOne) SetArticleID(v uuid.UUID) *ArticleTagUpsertOne

SetArticleID sets the "article_id" field.

func (*ArticleTagUpsertOne) SetTag

SetTag sets the "tag" field.

func (*ArticleTagUpsertOne) Update

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

func (*ArticleTagUpsertOne) UpdateArticleID

func (u *ArticleTagUpsertOne) UpdateArticleID() *ArticleTagUpsertOne

UpdateArticleID sets the "article_id" field to the value that was provided on create.

func (*ArticleTagUpsertOne) UpdateNewValues

func (u *ArticleTagUpsertOne) UpdateNewValues() *ArticleTagUpsertOne

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

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

func (*ArticleTagUpsertOne) UpdateTag

func (u *ArticleTagUpsertOne) UpdateTag() *ArticleTagUpsertOne

UpdateTag sets the "tag" field to the value that was provided on create.

type ArticleTags

type ArticleTags []*ArticleTag

ArticleTags is a parsable slice of ArticleTag.

type ArticleUpdate

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

ArticleUpdate is the builder for updating Article entities.

func (*ArticleUpdate) AddTagIDs

func (au *ArticleUpdate) AddTagIDs(ids ...uuid.UUID) *ArticleUpdate

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

func (*ArticleUpdate) AddTags

func (au *ArticleUpdate) AddTags(a ...*ArticleTag) *ArticleUpdate

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

func (*ArticleUpdate) AddUserArticleIDs

func (au *ArticleUpdate) AddUserArticleIDs(ids ...uuid.UUID) *ArticleUpdate

AddUserArticleIDs adds the "user_articles" edge to the UserArticle entity by IDs.

func (*ArticleUpdate) AddUserArticles

func (au *ArticleUpdate) AddUserArticles(u ...*UserArticle) *ArticleUpdate

AddUserArticles adds the "user_articles" edges to the UserArticle entity.

func (*ArticleUpdate) ClearTags

func (au *ArticleUpdate) ClearTags() *ArticleUpdate

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

func (*ArticleUpdate) ClearUserArticles

func (au *ArticleUpdate) ClearUserArticles() *ArticleUpdate

ClearUserArticles clears all "user_articles" edges to the UserArticle entity.

func (*ArticleUpdate) Exec

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

Exec executes the query.

func (*ArticleUpdate) ExecContext

func (c *ArticleUpdate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleUpdate) ExecX

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

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

func (*ArticleUpdate) Mutation

func (au *ArticleUpdate) Mutation() *ArticleMutation

Mutation returns the ArticleMutation object of the builder.

func (*ArticleUpdate) QueryContext

func (c *ArticleUpdate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleUpdate) RemoveTagIDs

func (au *ArticleUpdate) RemoveTagIDs(ids ...uuid.UUID) *ArticleUpdate

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

func (*ArticleUpdate) RemoveTags

func (au *ArticleUpdate) RemoveTags(a ...*ArticleTag) *ArticleUpdate

RemoveTags removes "tags" edges to ArticleTag entities.

func (*ArticleUpdate) RemoveUserArticleIDs

func (au *ArticleUpdate) RemoveUserArticleIDs(ids ...uuid.UUID) *ArticleUpdate

RemoveUserArticleIDs removes the "user_articles" edge to UserArticle entities by IDs.

func (*ArticleUpdate) RemoveUserArticles

func (au *ArticleUpdate) RemoveUserArticles(u ...*UserArticle) *ArticleUpdate

RemoveUserArticles removes "user_articles" edges to UserArticle entities.

func (*ArticleUpdate) Save

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

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

func (*ArticleUpdate) SaveX

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

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

func (*ArticleUpdate) SetCreatedAt

func (au *ArticleUpdate) SetCreatedAt(t time.Time) *ArticleUpdate

SetCreatedAt sets the "created_at" field.

func (*ArticleUpdate) SetDescription

func (au *ArticleUpdate) SetDescription(s string) *ArticleUpdate

SetDescription sets the "description" field.

func (*ArticleUpdate) SetNillableCreatedAt

func (au *ArticleUpdate) SetNillableCreatedAt(t *time.Time) *ArticleUpdate

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

func (*ArticleUpdate) SetThumbnail

func (au *ArticleUpdate) SetThumbnail(s string) *ArticleUpdate

SetThumbnail sets the "thumbnail" field.

func (*ArticleUpdate) SetTitle

func (au *ArticleUpdate) SetTitle(s string) *ArticleUpdate

SetTitle sets the "title" field.

func (*ArticleUpdate) SetURL

func (au *ArticleUpdate) SetURL(s string) *ArticleUpdate

SetURL sets the "url" field.

func (*ArticleUpdate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*ArticleUpdate) Where

func (au *ArticleUpdate) Where(ps ...predicate.Article) *ArticleUpdate

Where appends a list predicates to the ArticleUpdate builder.

type ArticleUpdateOne

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

ArticleUpdateOne is the builder for updating a single Article entity.

func (*ArticleUpdateOne) AddTagIDs

func (auo *ArticleUpdateOne) AddTagIDs(ids ...uuid.UUID) *ArticleUpdateOne

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

func (*ArticleUpdateOne) AddTags

func (auo *ArticleUpdateOne) AddTags(a ...*ArticleTag) *ArticleUpdateOne

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

func (*ArticleUpdateOne) AddUserArticleIDs

func (auo *ArticleUpdateOne) AddUserArticleIDs(ids ...uuid.UUID) *ArticleUpdateOne

AddUserArticleIDs adds the "user_articles" edge to the UserArticle entity by IDs.

func (*ArticleUpdateOne) AddUserArticles

func (auo *ArticleUpdateOne) AddUserArticles(u ...*UserArticle) *ArticleUpdateOne

AddUserArticles adds the "user_articles" edges to the UserArticle entity.

func (*ArticleUpdateOne) ClearTags

func (auo *ArticleUpdateOne) ClearTags() *ArticleUpdateOne

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

func (*ArticleUpdateOne) ClearUserArticles

func (auo *ArticleUpdateOne) ClearUserArticles() *ArticleUpdateOne

ClearUserArticles clears all "user_articles" edges to the UserArticle entity.

func (*ArticleUpdateOne) Exec

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

Exec executes the query on the entity.

func (*ArticleUpdateOne) ExecContext

func (c *ArticleUpdateOne) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*ArticleUpdateOne) ExecX

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

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

func (*ArticleUpdateOne) Mutation

func (auo *ArticleUpdateOne) Mutation() *ArticleMutation

Mutation returns the ArticleMutation object of the builder.

func (*ArticleUpdateOne) QueryContext

func (c *ArticleUpdateOne) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*ArticleUpdateOne) RemoveTagIDs

func (auo *ArticleUpdateOne) RemoveTagIDs(ids ...uuid.UUID) *ArticleUpdateOne

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

func (*ArticleUpdateOne) RemoveTags

func (auo *ArticleUpdateOne) RemoveTags(a ...*ArticleTag) *ArticleUpdateOne

RemoveTags removes "tags" edges to ArticleTag entities.

func (*ArticleUpdateOne) RemoveUserArticleIDs

func (auo *ArticleUpdateOne) RemoveUserArticleIDs(ids ...uuid.UUID) *ArticleUpdateOne

RemoveUserArticleIDs removes the "user_articles" edge to UserArticle entities by IDs.

func (*ArticleUpdateOne) RemoveUserArticles

func (auo *ArticleUpdateOne) RemoveUserArticles(u ...*UserArticle) *ArticleUpdateOne

RemoveUserArticles removes "user_articles" edges to UserArticle entities.

func (*ArticleUpdateOne) Save

func (auo *ArticleUpdateOne) Save(ctx context.Context) (*Article, error)

Save executes the query and returns the updated Article entity.

func (*ArticleUpdateOne) SaveX

func (auo *ArticleUpdateOne) SaveX(ctx context.Context) *Article

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

func (*ArticleUpdateOne) Select

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

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

func (*ArticleUpdateOne) SetCreatedAt

func (auo *ArticleUpdateOne) SetCreatedAt(t time.Time) *ArticleUpdateOne

SetCreatedAt sets the "created_at" field.

func (*ArticleUpdateOne) SetDescription

func (auo *ArticleUpdateOne) SetDescription(s string) *ArticleUpdateOne

SetDescription sets the "description" field.

func (*ArticleUpdateOne) SetNillableCreatedAt

func (auo *ArticleUpdateOne) SetNillableCreatedAt(t *time.Time) *ArticleUpdateOne

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

func (*ArticleUpdateOne) SetThumbnail

func (auo *ArticleUpdateOne) SetThumbnail(s string) *ArticleUpdateOne

SetThumbnail sets the "thumbnail" field.

func (*ArticleUpdateOne) SetTitle

func (auo *ArticleUpdateOne) SetTitle(s string) *ArticleUpdateOne

SetTitle sets the "title" field.

func (*ArticleUpdateOne) SetURL

func (auo *ArticleUpdateOne) SetURL(s string) *ArticleUpdateOne

SetURL sets the "url" field.

func (*ArticleUpdateOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*ArticleUpdateOne) Where

Where appends a list predicates to the ArticleUpdate builder.

type ArticleUpsert

type ArticleUpsert struct {
	*sql.UpdateSet
}

ArticleUpsert is the "OnConflict" setter.

func (*ArticleUpsert) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ArticleUpsert) SetDescription

func (u *ArticleUpsert) SetDescription(v string) *ArticleUpsert

SetDescription sets the "description" field.

func (*ArticleUpsert) SetThumbnail

func (u *ArticleUpsert) SetThumbnail(v string) *ArticleUpsert

SetThumbnail sets the "thumbnail" field.

func (*ArticleUpsert) SetTitle

func (u *ArticleUpsert) SetTitle(v string) *ArticleUpsert

SetTitle sets the "title" field.

func (*ArticleUpsert) SetURL

func (u *ArticleUpsert) SetURL(v string) *ArticleUpsert

SetURL sets the "url" field.

func (*ArticleUpsert) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*ArticleUpsert) UpdateCreatedAt

func (u *ArticleUpsert) UpdateCreatedAt() *ArticleUpsert

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

func (*ArticleUpsert) UpdateDescription

func (u *ArticleUpsert) UpdateDescription() *ArticleUpsert

UpdateDescription sets the "description" field to the value that was provided on create.

func (*ArticleUpsert) UpdateThumbnail

func (u *ArticleUpsert) UpdateThumbnail() *ArticleUpsert

UpdateThumbnail sets the "thumbnail" field to the value that was provided on create.

func (*ArticleUpsert) UpdateTitle

func (u *ArticleUpsert) UpdateTitle() *ArticleUpsert

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

func (*ArticleUpsert) UpdateURL

func (u *ArticleUpsert) UpdateURL() *ArticleUpsert

UpdateURL sets the "url" field to the value that was provided on create.

func (*ArticleUpsert) UpdateUpdatedAt

func (u *ArticleUpsert) UpdateUpdatedAt() *ArticleUpsert

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

type ArticleUpsertBulk

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

ArticleUpsertBulk is the builder for "upsert"-ing a bulk of Article nodes.

func (*ArticleUpsertBulk) DoNothing

func (u *ArticleUpsertBulk) DoNothing() *ArticleUpsertBulk

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

func (*ArticleUpsertBulk) Exec

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

Exec executes the query.

func (*ArticleUpsertBulk) ExecX

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

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

func (*ArticleUpsertBulk) Ignore

func (u *ArticleUpsertBulk) Ignore() *ArticleUpsertBulk

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

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

func (*ArticleUpsertBulk) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ArticleUpsertBulk) SetDescription

func (u *ArticleUpsertBulk) SetDescription(v string) *ArticleUpsertBulk

SetDescription sets the "description" field.

func (*ArticleUpsertBulk) SetThumbnail

func (u *ArticleUpsertBulk) SetThumbnail(v string) *ArticleUpsertBulk

SetThumbnail sets the "thumbnail" field.

func (*ArticleUpsertBulk) SetTitle

func (u *ArticleUpsertBulk) SetTitle(v string) *ArticleUpsertBulk

SetTitle sets the "title" field.

func (*ArticleUpsertBulk) SetURL

SetURL sets the "url" field.

func (*ArticleUpsertBulk) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*ArticleUpsertBulk) Update

func (u *ArticleUpsertBulk) Update(set func(*ArticleUpsert)) *ArticleUpsertBulk

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

func (*ArticleUpsertBulk) UpdateCreatedAt

func (u *ArticleUpsertBulk) UpdateCreatedAt() *ArticleUpsertBulk

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

func (*ArticleUpsertBulk) UpdateDescription

func (u *ArticleUpsertBulk) UpdateDescription() *ArticleUpsertBulk

UpdateDescription sets the "description" field to the value that was provided on create.

func (*ArticleUpsertBulk) UpdateNewValues

func (u *ArticleUpsertBulk) UpdateNewValues() *ArticleUpsertBulk

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

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

func (*ArticleUpsertBulk) UpdateThumbnail

func (u *ArticleUpsertBulk) UpdateThumbnail() *ArticleUpsertBulk

UpdateThumbnail sets the "thumbnail" field to the value that was provided on create.

func (*ArticleUpsertBulk) UpdateTitle

func (u *ArticleUpsertBulk) UpdateTitle() *ArticleUpsertBulk

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

func (*ArticleUpsertBulk) UpdateURL

func (u *ArticleUpsertBulk) UpdateURL() *ArticleUpsertBulk

UpdateURL sets the "url" field to the value that was provided on create.

func (*ArticleUpsertBulk) UpdateUpdatedAt

func (u *ArticleUpsertBulk) UpdateUpdatedAt() *ArticleUpsertBulk

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

type ArticleUpsertOne

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

ArticleUpsertOne is the builder for "upsert"-ing

one Article node.

func (*ArticleUpsertOne) DoNothing

func (u *ArticleUpsertOne) DoNothing() *ArticleUpsertOne

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

func (*ArticleUpsertOne) Exec

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

Exec executes the query.

func (*ArticleUpsertOne) ExecX

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

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

func (*ArticleUpsertOne) ID

func (u *ArticleUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ArticleUpsertOne) IDX

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

func (*ArticleUpsertOne) Ignore

func (u *ArticleUpsertOne) Ignore() *ArticleUpsertOne

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

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

func (*ArticleUpsertOne) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ArticleUpsertOne) SetDescription

func (u *ArticleUpsertOne) SetDescription(v string) *ArticleUpsertOne

SetDescription sets the "description" field.

func (*ArticleUpsertOne) SetThumbnail

func (u *ArticleUpsertOne) SetThumbnail(v string) *ArticleUpsertOne

SetThumbnail sets the "thumbnail" field.

func (*ArticleUpsertOne) SetTitle

func (u *ArticleUpsertOne) SetTitle(v string) *ArticleUpsertOne

SetTitle sets the "title" field.

func (*ArticleUpsertOne) SetURL

SetURL sets the "url" field.

func (*ArticleUpsertOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*ArticleUpsertOne) Update

func (u *ArticleUpsertOne) Update(set func(*ArticleUpsert)) *ArticleUpsertOne

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

func (*ArticleUpsertOne) UpdateCreatedAt

func (u *ArticleUpsertOne) UpdateCreatedAt() *ArticleUpsertOne

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

func (*ArticleUpsertOne) UpdateDescription

func (u *ArticleUpsertOne) UpdateDescription() *ArticleUpsertOne

UpdateDescription sets the "description" field to the value that was provided on create.

func (*ArticleUpsertOne) UpdateNewValues

func (u *ArticleUpsertOne) UpdateNewValues() *ArticleUpsertOne

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

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

func (*ArticleUpsertOne) UpdateThumbnail

func (u *ArticleUpsertOne) UpdateThumbnail() *ArticleUpsertOne

UpdateThumbnail sets the "thumbnail" field to the value that was provided on create.

func (*ArticleUpsertOne) UpdateTitle

func (u *ArticleUpsertOne) UpdateTitle() *ArticleUpsertOne

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

func (*ArticleUpsertOne) UpdateURL

func (u *ArticleUpsertOne) UpdateURL() *ArticleUpsertOne

UpdateURL sets the "url" field to the value that was provided on create.

func (*ArticleUpsertOne) UpdateUpdatedAt

func (u *ArticleUpsertOne) UpdateUpdatedAt() *ArticleUpsertOne

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

type Articles

type Articles []*Article

Articles is a parsable slice of Article.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Article is the client for interacting with the Article builders.
	Article *ArticleClient
	// ArticleTag is the client for interacting with the ArticleTag builders.
	ArticleTag *ArticleTagClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UserArticle is the client for interacting with the UserArticle builders.
	UserArticle *UserArticleClient
	// 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().
	Article.
	Query().
	Count(ctx)

func (*Client) ExecContext

func (c *Client) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) QueryContext

func (c *Client) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

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

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Article is the client for interacting with the Article builders.
	Article *ArticleClient
	// ArticleTag is the client for interacting with the ArticleTag builders.
	ArticleTag *ArticleTagClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UserArticle is the client for interacting with the UserArticle builders.
	UserArticle *UserArticleClient
	// 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) ExecContext

func (c *Tx) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

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) QueryContext

func (c *Tx) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// 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) ExecContext

func (c *User) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*User) QueryContext

func (c *User) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*User) QueryUserArticles

func (u *User) QueryUserArticles() *UserArticleQuery

QueryUserArticles queries the "user_articles" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*User) Update

func (u *User) Update() *UserUpdateOne

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

func (*User) Value

func (u *User) Value(name string) (ent.Value, error)

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

type UserArticle

type UserArticle struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// ArticleID holds the value of the "article_id" field.
	ArticleID uuid.UUID `json:"article_id,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID uuid.UUID `json:"user_id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserArticleQuery when eager-loading is set.
	Edges UserArticleEdges `json:"edges"`
	// contains filtered or unexported fields
}

UserArticle is the model entity for the UserArticle schema.

func (*UserArticle) ExecContext

func (c *UserArticle) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserArticle) QueryArticle

func (ua *UserArticle) QueryArticle() *ArticleQuery

QueryArticle queries the "article" edge of the UserArticle entity.

func (*UserArticle) QueryContext

func (c *UserArticle) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserArticle) QueryUser

func (ua *UserArticle) QueryUser() *UserQuery

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

func (*UserArticle) String

func (ua *UserArticle) String() string

String implements the fmt.Stringer.

func (*UserArticle) Unwrap

func (ua *UserArticle) Unwrap() *UserArticle

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

func (ua *UserArticle) Update() *UserArticleUpdateOne

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

func (*UserArticle) Value

func (ua *UserArticle) Value(name string) (ent.Value, error)

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

type UserArticleClient

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

UserArticleClient is a client for the UserArticle schema.

func NewUserArticleClient

func NewUserArticleClient(c config) *UserArticleClient

NewUserArticleClient returns a client for the UserArticle from the given config.

func (*UserArticleClient) Create

func (c *UserArticleClient) Create() *UserArticleCreate

Create returns a builder for creating a UserArticle entity.

func (*UserArticleClient) CreateBulk

func (c *UserArticleClient) CreateBulk(builders ...*UserArticleCreate) *UserArticleCreateBulk

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

func (*UserArticleClient) Delete

func (c *UserArticleClient) Delete() *UserArticleDelete

Delete returns a delete builder for UserArticle.

func (*UserArticleClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserArticleClient) DeleteOneID

func (c *UserArticleClient) DeleteOneID(id uuid.UUID) *UserArticleDeleteOne

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

func (*UserArticleClient) ExecContext

func (c *UserArticleClient) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserArticleClient) Get

Get returns a UserArticle entity by its id.

func (*UserArticleClient) GetX

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

func (*UserArticleClient) Hooks

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

Hooks returns the client hooks.

func (*UserArticleClient) Intercept

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

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

func (*UserArticleClient) Interceptors

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

Interceptors returns the client interceptors.

func (*UserArticleClient) Query

func (c *UserArticleClient) Query() *UserArticleQuery

Query returns a query builder for UserArticle.

func (*UserArticleClient) QueryArticle

func (c *UserArticleClient) QueryArticle(ua *UserArticle) *ArticleQuery

QueryArticle queries the article edge of a UserArticle.

func (*UserArticleClient) QueryContext

func (c *UserArticleClient) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserArticleClient) QueryUser

func (c *UserArticleClient) QueryUser(ua *UserArticle) *UserQuery

QueryUser queries the user edge of a UserArticle.

func (*UserArticleClient) Update

func (c *UserArticleClient) Update() *UserArticleUpdate

Update returns an update builder for UserArticle.

func (*UserArticleClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserArticleClient) UpdateOneID

func (c *UserArticleClient) UpdateOneID(id uuid.UUID) *UserArticleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserArticleClient) Use

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

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

type UserArticleCreate

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

UserArticleCreate is the builder for creating a UserArticle entity.

func (*UserArticleCreate) Exec

func (uac *UserArticleCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserArticleCreate) ExecContext

func (c *UserArticleCreate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserArticleCreate) ExecX

func (uac *UserArticleCreate) ExecX(ctx context.Context)

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

func (*UserArticleCreate) Mutation

func (uac *UserArticleCreate) Mutation() *UserArticleMutation

Mutation returns the UserArticleMutation object of the builder.

func (*UserArticleCreate) OnConflict

func (uac *UserArticleCreate) OnConflict(opts ...sql.ConflictOption) *UserArticleUpsertOne

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

client.UserArticle.Create().
	SetArticleID(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.UserArticleUpsert) {
		SetArticleID(v+v).
	}).
	Exec(ctx)

func (*UserArticleCreate) OnConflictColumns

func (uac *UserArticleCreate) OnConflictColumns(columns ...string) *UserArticleUpsertOne

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

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

func (*UserArticleCreate) QueryContext

func (c *UserArticleCreate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserArticleCreate) Save

func (uac *UserArticleCreate) Save(ctx context.Context) (*UserArticle, error)

Save creates the UserArticle in the database.

func (*UserArticleCreate) SaveX

func (uac *UserArticleCreate) SaveX(ctx context.Context) *UserArticle

SaveX calls Save and panics if Save returns an error.

func (*UserArticleCreate) SetArticle

func (uac *UserArticleCreate) SetArticle(a *Article) *UserArticleCreate

SetArticle sets the "article" edge to the Article entity.

func (*UserArticleCreate) SetArticleID

func (uac *UserArticleCreate) SetArticleID(u uuid.UUID) *UserArticleCreate

SetArticleID sets the "article_id" field.

func (*UserArticleCreate) SetCreatedAt

func (uac *UserArticleCreate) SetCreatedAt(t time.Time) *UserArticleCreate

SetCreatedAt sets the "created_at" field.

func (*UserArticleCreate) SetID

SetID sets the "id" field.

func (*UserArticleCreate) SetNillableCreatedAt

func (uac *UserArticleCreate) SetNillableCreatedAt(t *time.Time) *UserArticleCreate

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

func (*UserArticleCreate) SetNillableID

func (uac *UserArticleCreate) SetNillableID(u *uuid.UUID) *UserArticleCreate

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

func (*UserArticleCreate) SetNillableUpdatedAt

func (uac *UserArticleCreate) SetNillableUpdatedAt(t *time.Time) *UserArticleCreate

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

func (*UserArticleCreate) SetUpdatedAt

func (uac *UserArticleCreate) SetUpdatedAt(t time.Time) *UserArticleCreate

SetUpdatedAt sets the "updated_at" field.

func (*UserArticleCreate) SetUser

func (uac *UserArticleCreate) SetUser(u *User) *UserArticleCreate

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

func (*UserArticleCreate) SetUserID

func (uac *UserArticleCreate) SetUserID(u uuid.UUID) *UserArticleCreate

SetUserID sets the "user_id" field.

type UserArticleCreateBulk

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

UserArticleCreateBulk is the builder for creating many UserArticle entities in bulk.

func (*UserArticleCreateBulk) Exec

func (uacb *UserArticleCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserArticleCreateBulk) ExecContext

func (c *UserArticleCreateBulk) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserArticleCreateBulk) ExecX

func (uacb *UserArticleCreateBulk) ExecX(ctx context.Context)

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

func (*UserArticleCreateBulk) OnConflict

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

client.UserArticle.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.UserArticleUpsert) {
		SetArticleID(v+v).
	}).
	Exec(ctx)

func (*UserArticleCreateBulk) OnConflictColumns

func (uacb *UserArticleCreateBulk) OnConflictColumns(columns ...string) *UserArticleUpsertBulk

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

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

func (*UserArticleCreateBulk) QueryContext

func (c *UserArticleCreateBulk) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserArticleCreateBulk) Save

func (uacb *UserArticleCreateBulk) Save(ctx context.Context) ([]*UserArticle, error)

Save creates the UserArticle entities in the database.

func (*UserArticleCreateBulk) SaveX

func (uacb *UserArticleCreateBulk) SaveX(ctx context.Context) []*UserArticle

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

type UserArticleDelete

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

UserArticleDelete is the builder for deleting a UserArticle entity.

func (*UserArticleDelete) Exec

func (uad *UserArticleDelete) Exec(ctx context.Context) (int, error)

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

func (*UserArticleDelete) ExecContext

func (c *UserArticleDelete) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserArticleDelete) ExecX

func (uad *UserArticleDelete) ExecX(ctx context.Context) int

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

func (*UserArticleDelete) QueryContext

func (c *UserArticleDelete) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserArticleDelete) Where

Where appends a list predicates to the UserArticleDelete builder.

type UserArticleDeleteOne

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

UserArticleDeleteOne is the builder for deleting a single UserArticle entity.

func (*UserArticleDeleteOne) Exec

func (uado *UserArticleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserArticleDeleteOne) ExecX

func (uado *UserArticleDeleteOne) ExecX(ctx context.Context)

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

func (*UserArticleDeleteOne) Where

Where appends a list predicates to the UserArticleDelete builder.

type UserArticleEdges

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

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

func (UserArticleEdges) ArticleOrErr

func (e UserArticleEdges) ArticleOrErr() (*Article, error)

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

func (UserArticleEdges) UserOrErr

func (e UserArticleEdges) 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 UserArticleGroupBy

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

UserArticleGroupBy is the group-by builder for UserArticle entities.

func (*UserArticleGroupBy) Aggregate

func (uagb *UserArticleGroupBy) Aggregate(fns ...AggregateFunc) *UserArticleGroupBy

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

func (*UserArticleGroupBy) Bool

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

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

func (*UserArticleGroupBy) BoolX

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

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

func (*UserArticleGroupBy) Bools

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

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

func (*UserArticleGroupBy) BoolsX

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

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

func (*UserArticleGroupBy) Float64

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

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

func (*UserArticleGroupBy) Float64X

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

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

func (*UserArticleGroupBy) Float64s

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

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

func (*UserArticleGroupBy) Float64sX

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

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

func (*UserArticleGroupBy) Int

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

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

func (*UserArticleGroupBy) IntX

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

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

func (*UserArticleGroupBy) Ints

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

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

func (*UserArticleGroupBy) IntsX

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

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

func (*UserArticleGroupBy) Scan

func (uagb *UserArticleGroupBy) Scan(ctx context.Context, v any) error

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

func (*UserArticleGroupBy) ScanX

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

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

func (*UserArticleGroupBy) String

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

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

func (*UserArticleGroupBy) StringX

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

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

func (*UserArticleGroupBy) Strings

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

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

func (*UserArticleGroupBy) StringsX

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

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

type UserArticleMutation

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

UserArticleMutation represents an operation that mutates the UserArticle nodes in the graph.

func (*UserArticleMutation) AddField

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

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

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

func (*UserArticleMutation) AddedField

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

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

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

func (*UserArticleMutation) AddedIDs

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

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

func (*UserArticleMutation) ArticleCleared

func (m *UserArticleMutation) ArticleCleared() bool

ArticleCleared reports if the "article" edge to the Article entity was cleared.

func (*UserArticleMutation) ArticleID

func (m *UserArticleMutation) ArticleID() (r uuid.UUID, exists bool)

ArticleID returns the value of the "article_id" field in the mutation.

func (*UserArticleMutation) ArticleIDs

func (m *UserArticleMutation) ArticleIDs() (ids []uuid.UUID)

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

func (*UserArticleMutation) ClearArticle

func (m *UserArticleMutation) ClearArticle()

ClearArticle clears the "article" edge to the Article entity.

func (*UserArticleMutation) ClearEdge

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

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

func (m *UserArticleMutation) ClearUser()

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

func (*UserArticleMutation) ClearedEdges

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

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

func (*UserArticleMutation) ClearedFields

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

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

func (UserArticleMutation) Client

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

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

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

func (*UserArticleMutation) EdgeCleared

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

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

func (*UserArticleMutation) ExecContext

func (c *UserArticleMutation) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserArticleMutation) Field

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

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

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

func (*UserArticleMutation) Fields

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

func (m *UserArticleMutation) ID() (id uuid.UUID, 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 (*UserArticleMutation) IDs

func (m *UserArticleMutation) IDs(ctx context.Context) ([]uuid.UUID, 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 (*UserArticleMutation) OldArticleID

func (m *UserArticleMutation) OldArticleID(ctx context.Context) (v uuid.UUID, err error)

OldArticleID returns the old "article_id" field's value of the UserArticle entity. If the UserArticle 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 (*UserArticleMutation) OldCreatedAt

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

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

func (m *UserArticleMutation) 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 (*UserArticleMutation) OldUpdatedAt

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

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

func (m *UserArticleMutation) OldUserID(ctx context.Context) (v uuid.UUID, err error)

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

func (m *UserArticleMutation) Op() Op

Op returns the operation name.

func (*UserArticleMutation) QueryContext

func (c *UserArticleMutation) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserArticleMutation) RemovedEdges

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

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

func (*UserArticleMutation) RemovedIDs

func (m *UserArticleMutation) 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 (*UserArticleMutation) ResetArticle

func (m *UserArticleMutation) ResetArticle()

ResetArticle resets all changes to the "article" edge.

func (*UserArticleMutation) ResetArticleID

func (m *UserArticleMutation) ResetArticleID()

ResetArticleID resets all changes to the "article_id" field.

func (*UserArticleMutation) ResetCreatedAt

func (m *UserArticleMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserArticleMutation) ResetEdge

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

func (m *UserArticleMutation) 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 (*UserArticleMutation) ResetUpdatedAt

func (m *UserArticleMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserArticleMutation) ResetUser

func (m *UserArticleMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*UserArticleMutation) ResetUserID

func (m *UserArticleMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*UserArticleMutation) SetArticleID

func (m *UserArticleMutation) SetArticleID(u uuid.UUID)

SetArticleID sets the "article_id" field.

func (*UserArticleMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*UserArticleMutation) SetField

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

func (m *UserArticleMutation) SetID(id uuid.UUID)

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

func (*UserArticleMutation) SetOp

func (m *UserArticleMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserArticleMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UserArticleMutation) SetUserID

func (m *UserArticleMutation) SetUserID(u uuid.UUID)

SetUserID sets the "user_id" field.

func (UserArticleMutation) Tx

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

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

func (*UserArticleMutation) Type

func (m *UserArticleMutation) Type() string

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

func (*UserArticleMutation) UpdatedAt

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

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

func (*UserArticleMutation) UserCleared

func (m *UserArticleMutation) UserCleared() bool

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

func (*UserArticleMutation) UserID

func (m *UserArticleMutation) UserID() (r uuid.UUID, exists bool)

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

func (*UserArticleMutation) UserIDs

func (m *UserArticleMutation) UserIDs() (ids []uuid.UUID)

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

func (m *UserArticleMutation) Where(ps ...predicate.UserArticle)

Where appends a list predicates to the UserArticleMutation builder.

func (*UserArticleMutation) WhereP

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

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

type UserArticleQuery

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

UserArticleQuery is the builder for querying UserArticle entities.

func (*UserArticleQuery) Aggregate

func (uaq *UserArticleQuery) Aggregate(fns ...AggregateFunc) *UserArticleSelect

Aggregate returns a UserArticleSelect configured with the given aggregations.

func (*UserArticleQuery) All

func (uaq *UserArticleQuery) All(ctx context.Context) ([]*UserArticle, error)

All executes the query and returns a list of UserArticles.

func (*UserArticleQuery) AllX

func (uaq *UserArticleQuery) AllX(ctx context.Context) []*UserArticle

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

func (*UserArticleQuery) Clone

func (uaq *UserArticleQuery) Clone() *UserArticleQuery

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

func (*UserArticleQuery) Count

func (uaq *UserArticleQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserArticleQuery) CountX

func (uaq *UserArticleQuery) CountX(ctx context.Context) int

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

func (*UserArticleQuery) ExecContext

func (c *UserArticleQuery) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserArticleQuery) Exist

func (uaq *UserArticleQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserArticleQuery) ExistX

func (uaq *UserArticleQuery) ExistX(ctx context.Context) bool

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

func (*UserArticleQuery) First

func (uaq *UserArticleQuery) First(ctx context.Context) (*UserArticle, error)

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

func (*UserArticleQuery) FirstID

func (uaq *UserArticleQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*UserArticleQuery) FirstIDX

func (uaq *UserArticleQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*UserArticleQuery) FirstX

func (uaq *UserArticleQuery) FirstX(ctx context.Context) *UserArticle

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

func (*UserArticleQuery) ForShare

func (uaq *UserArticleQuery) ForShare(opts ...sql.LockOption) *UserArticleQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*UserArticleQuery) ForUpdate

func (uaq *UserArticleQuery) ForUpdate(opts ...sql.LockOption) *UserArticleQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

func (*UserArticleQuery) GroupBy

func (uaq *UserArticleQuery) GroupBy(field string, fields ...string) *UserArticleGroupBy

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 {
	ArticleID uuid.UUID `json:"article_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.UserArticle.Query().
	GroupBy(userarticle.FieldArticleID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserArticleQuery) IDs

func (uaq *UserArticleQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*UserArticleQuery) IDsX

func (uaq *UserArticleQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*UserArticleQuery) Limit

func (uaq *UserArticleQuery) Limit(limit int) *UserArticleQuery

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

func (*UserArticleQuery) Offset

func (uaq *UserArticleQuery) Offset(offset int) *UserArticleQuery

Offset to start from.

func (*UserArticleQuery) Only

func (uaq *UserArticleQuery) Only(ctx context.Context) (*UserArticle, error)

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

func (*UserArticleQuery) OnlyID

func (uaq *UserArticleQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*UserArticleQuery) OnlyIDX

func (uaq *UserArticleQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*UserArticleQuery) OnlyX

func (uaq *UserArticleQuery) OnlyX(ctx context.Context) *UserArticle

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

func (*UserArticleQuery) Order

Order specifies how the records should be ordered.

func (*UserArticleQuery) QueryArticle

func (uaq *UserArticleQuery) QueryArticle() *ArticleQuery

QueryArticle chains the current query on the "article" edge.

func (*UserArticleQuery) QueryContext

func (c *UserArticleQuery) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserArticleQuery) QueryUser

func (uaq *UserArticleQuery) QueryUser() *UserQuery

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

func (*UserArticleQuery) Select

func (uaq *UserArticleQuery) Select(fields ...string) *UserArticleSelect

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 {
	ArticleID uuid.UUID `json:"article_id,omitempty"`
}

client.UserArticle.Query().
	Select(userarticle.FieldArticleID).
	Scan(ctx, &v)

func (*UserArticleQuery) Unique

func (uaq *UserArticleQuery) Unique(unique bool) *UserArticleQuery

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

Where adds a new predicate for the UserArticleQuery builder.

func (*UserArticleQuery) WithArticle

func (uaq *UserArticleQuery) WithArticle(opts ...func(*ArticleQuery)) *UserArticleQuery

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

func (*UserArticleQuery) WithUser

func (uaq *UserArticleQuery) WithUser(opts ...func(*UserQuery)) *UserArticleQuery

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 UserArticleSelect

type UserArticleSelect struct {
	*UserArticleQuery
	// contains filtered or unexported fields
}

UserArticleSelect is the builder for selecting fields of UserArticle entities.

func (*UserArticleSelect) Aggregate

func (uas *UserArticleSelect) Aggregate(fns ...AggregateFunc) *UserArticleSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserArticleSelect) Bool

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

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

func (*UserArticleSelect) BoolX

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

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

func (*UserArticleSelect) Bools

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

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

func (*UserArticleSelect) BoolsX

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

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

func (UserArticleSelect) ExecContext

func (c UserArticleSelect) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserArticleSelect) Float64

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

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

func (*UserArticleSelect) Float64X

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

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

func (*UserArticleSelect) Float64s

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

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

func (*UserArticleSelect) Float64sX

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

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

func (*UserArticleSelect) Int

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

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

func (*UserArticleSelect) IntX

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

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

func (*UserArticleSelect) Ints

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

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

func (*UserArticleSelect) IntsX

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

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

func (UserArticleSelect) QueryContext

func (c UserArticleSelect) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserArticleSelect) Scan

func (uas *UserArticleSelect) Scan(ctx context.Context, v any) error

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

func (*UserArticleSelect) ScanX

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

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

func (*UserArticleSelect) String

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

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

func (*UserArticleSelect) StringX

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

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

func (*UserArticleSelect) Strings

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

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

func (*UserArticleSelect) StringsX

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

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

type UserArticleUpdate

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

UserArticleUpdate is the builder for updating UserArticle entities.

func (*UserArticleUpdate) ClearArticle

func (uau *UserArticleUpdate) ClearArticle() *UserArticleUpdate

ClearArticle clears the "article" edge to the Article entity.

func (*UserArticleUpdate) ClearUser

func (uau *UserArticleUpdate) ClearUser() *UserArticleUpdate

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

func (*UserArticleUpdate) Exec

func (uau *UserArticleUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserArticleUpdate) ExecContext

func (c *UserArticleUpdate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserArticleUpdate) ExecX

func (uau *UserArticleUpdate) ExecX(ctx context.Context)

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

func (*UserArticleUpdate) Mutation

func (uau *UserArticleUpdate) Mutation() *UserArticleMutation

Mutation returns the UserArticleMutation object of the builder.

func (*UserArticleUpdate) QueryContext

func (c *UserArticleUpdate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserArticleUpdate) Save

func (uau *UserArticleUpdate) Save(ctx context.Context) (int, error)

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

func (*UserArticleUpdate) SaveX

func (uau *UserArticleUpdate) SaveX(ctx context.Context) int

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

func (*UserArticleUpdate) SetArticle

func (uau *UserArticleUpdate) SetArticle(a *Article) *UserArticleUpdate

SetArticle sets the "article" edge to the Article entity.

func (*UserArticleUpdate) SetArticleID

func (uau *UserArticleUpdate) SetArticleID(u uuid.UUID) *UserArticleUpdate

SetArticleID sets the "article_id" field.

func (*UserArticleUpdate) SetCreatedAt

func (uau *UserArticleUpdate) SetCreatedAt(t time.Time) *UserArticleUpdate

SetCreatedAt sets the "created_at" field.

func (*UserArticleUpdate) SetNillableCreatedAt

func (uau *UserArticleUpdate) SetNillableCreatedAt(t *time.Time) *UserArticleUpdate

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

func (*UserArticleUpdate) SetUpdatedAt

func (uau *UserArticleUpdate) SetUpdatedAt(t time.Time) *UserArticleUpdate

SetUpdatedAt sets the "updated_at" field.

func (*UserArticleUpdate) SetUser

func (uau *UserArticleUpdate) SetUser(u *User) *UserArticleUpdate

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

func (*UserArticleUpdate) SetUserID

func (uau *UserArticleUpdate) SetUserID(u uuid.UUID) *UserArticleUpdate

SetUserID sets the "user_id" field.

func (*UserArticleUpdate) Where

Where appends a list predicates to the UserArticleUpdate builder.

type UserArticleUpdateOne

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

UserArticleUpdateOne is the builder for updating a single UserArticle entity.

func (*UserArticleUpdateOne) ClearArticle

func (uauo *UserArticleUpdateOne) ClearArticle() *UserArticleUpdateOne

ClearArticle clears the "article" edge to the Article entity.

func (*UserArticleUpdateOne) ClearUser

func (uauo *UserArticleUpdateOne) ClearUser() *UserArticleUpdateOne

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

func (*UserArticleUpdateOne) Exec

func (uauo *UserArticleUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserArticleUpdateOne) ExecContext

func (c *UserArticleUpdateOne) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserArticleUpdateOne) ExecX

func (uauo *UserArticleUpdateOne) ExecX(ctx context.Context)

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

func (*UserArticleUpdateOne) Mutation

func (uauo *UserArticleUpdateOne) Mutation() *UserArticleMutation

Mutation returns the UserArticleMutation object of the builder.

func (*UserArticleUpdateOne) QueryContext

func (c *UserArticleUpdateOne) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserArticleUpdateOne) Save

Save executes the query and returns the updated UserArticle entity.

func (*UserArticleUpdateOne) SaveX

func (uauo *UserArticleUpdateOne) SaveX(ctx context.Context) *UserArticle

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

func (*UserArticleUpdateOne) Select

func (uauo *UserArticleUpdateOne) Select(field string, fields ...string) *UserArticleUpdateOne

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

func (*UserArticleUpdateOne) SetArticle

func (uauo *UserArticleUpdateOne) SetArticle(a *Article) *UserArticleUpdateOne

SetArticle sets the "article" edge to the Article entity.

func (*UserArticleUpdateOne) SetArticleID

func (uauo *UserArticleUpdateOne) SetArticleID(u uuid.UUID) *UserArticleUpdateOne

SetArticleID sets the "article_id" field.

func (*UserArticleUpdateOne) SetCreatedAt

func (uauo *UserArticleUpdateOne) SetCreatedAt(t time.Time) *UserArticleUpdateOne

SetCreatedAt sets the "created_at" field.

func (*UserArticleUpdateOne) SetNillableCreatedAt

func (uauo *UserArticleUpdateOne) SetNillableCreatedAt(t *time.Time) *UserArticleUpdateOne

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

func (*UserArticleUpdateOne) SetUpdatedAt

func (uauo *UserArticleUpdateOne) SetUpdatedAt(t time.Time) *UserArticleUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserArticleUpdateOne) SetUser

func (uauo *UserArticleUpdateOne) SetUser(u *User) *UserArticleUpdateOne

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

func (*UserArticleUpdateOne) SetUserID

func (uauo *UserArticleUpdateOne) SetUserID(u uuid.UUID) *UserArticleUpdateOne

SetUserID sets the "user_id" field.

func (*UserArticleUpdateOne) Where

Where appends a list predicates to the UserArticleUpdate builder.

type UserArticleUpsert

type UserArticleUpsert struct {
	*sql.UpdateSet
}

UserArticleUpsert is the "OnConflict" setter.

func (*UserArticleUpsert) SetArticleID

func (u *UserArticleUpsert) SetArticleID(v uuid.UUID) *UserArticleUpsert

SetArticleID sets the "article_id" field.

func (*UserArticleUpsert) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*UserArticleUpsert) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UserArticleUpsert) SetUserID

func (u *UserArticleUpsert) SetUserID(v uuid.UUID) *UserArticleUpsert

SetUserID sets the "user_id" field.

func (*UserArticleUpsert) UpdateArticleID

func (u *UserArticleUpsert) UpdateArticleID() *UserArticleUpsert

UpdateArticleID sets the "article_id" field to the value that was provided on create.

func (*UserArticleUpsert) UpdateCreatedAt

func (u *UserArticleUpsert) UpdateCreatedAt() *UserArticleUpsert

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

func (*UserArticleUpsert) UpdateUpdatedAt

func (u *UserArticleUpsert) UpdateUpdatedAt() *UserArticleUpsert

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

func (*UserArticleUpsert) UpdateUserID

func (u *UserArticleUpsert) UpdateUserID() *UserArticleUpsert

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

type UserArticleUpsertBulk

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

UserArticleUpsertBulk is the builder for "upsert"-ing a bulk of UserArticle nodes.

func (*UserArticleUpsertBulk) DoNothing

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

func (*UserArticleUpsertBulk) Exec

Exec executes the query.

func (*UserArticleUpsertBulk) ExecX

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

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

func (*UserArticleUpsertBulk) Ignore

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

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

func (*UserArticleUpsertBulk) SetArticleID

SetArticleID sets the "article_id" field.

func (*UserArticleUpsertBulk) SetCreatedAt

SetCreatedAt sets the "created_at" field.

func (*UserArticleUpsertBulk) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*UserArticleUpsertBulk) SetUserID

SetUserID sets the "user_id" field.

func (*UserArticleUpsertBulk) Update

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

func (*UserArticleUpsertBulk) UpdateArticleID

func (u *UserArticleUpsertBulk) UpdateArticleID() *UserArticleUpsertBulk

UpdateArticleID sets the "article_id" field to the value that was provided on create.

func (*UserArticleUpsertBulk) UpdateCreatedAt

func (u *UserArticleUpsertBulk) UpdateCreatedAt() *UserArticleUpsertBulk

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

func (*UserArticleUpsertBulk) UpdateNewValues

func (u *UserArticleUpsertBulk) UpdateNewValues() *UserArticleUpsertBulk

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

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

func (*UserArticleUpsertBulk) UpdateUpdatedAt

func (u *UserArticleUpsertBulk) UpdateUpdatedAt() *UserArticleUpsertBulk

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

func (*UserArticleUpsertBulk) UpdateUserID

func (u *UserArticleUpsertBulk) UpdateUserID() *UserArticleUpsertBulk

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

type UserArticleUpsertOne

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

UserArticleUpsertOne is the builder for "upsert"-ing

one UserArticle node.

func (*UserArticleUpsertOne) DoNothing

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

func (*UserArticleUpsertOne) Exec

Exec executes the query.

func (*UserArticleUpsertOne) ExecX

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

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

func (*UserArticleUpsertOne) ID

func (u *UserArticleUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error)

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

func (*UserArticleUpsertOne) IDX

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

func (*UserArticleUpsertOne) Ignore

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

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

func (*UserArticleUpsertOne) SetArticleID

func (u *UserArticleUpsertOne) SetArticleID(v uuid.UUID) *UserArticleUpsertOne

SetArticleID sets the "article_id" field.

func (*UserArticleUpsertOne) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*UserArticleUpsertOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UserArticleUpsertOne) SetUserID

SetUserID sets the "user_id" field.

func (*UserArticleUpsertOne) Update

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

func (*UserArticleUpsertOne) UpdateArticleID

func (u *UserArticleUpsertOne) UpdateArticleID() *UserArticleUpsertOne

UpdateArticleID sets the "article_id" field to the value that was provided on create.

func (*UserArticleUpsertOne) UpdateCreatedAt

func (u *UserArticleUpsertOne) UpdateCreatedAt() *UserArticleUpsertOne

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

func (*UserArticleUpsertOne) UpdateNewValues

func (u *UserArticleUpsertOne) UpdateNewValues() *UserArticleUpsertOne

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

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

func (*UserArticleUpsertOne) UpdateUpdatedAt

func (u *UserArticleUpsertOne) UpdateUpdatedAt() *UserArticleUpsertOne

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

func (*UserArticleUpsertOne) UpdateUserID

func (u *UserArticleUpsertOne) UpdateUserID() *UserArticleUpsertOne

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

type UserArticles

type UserArticles []*UserArticle

UserArticles is a parsable slice of UserArticle.

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id uuid.UUID) *UserDeleteOne

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

func (*UserClient) ExecContext

func (c *UserClient) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id uuid.UUID) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Intercept

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

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

func (*UserClient) Interceptors

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

Interceptors returns the client interceptors.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryContext

func (c *UserClient) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserClient) QueryUserArticles

func (c *UserClient) QueryUserArticles(u *User) *UserArticleQuery

QueryUserArticles queries the user_articles 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 uuid.UUID) *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) AddUserArticleIDs

func (uc *UserCreate) AddUserArticleIDs(ids ...uuid.UUID) *UserCreate

AddUserArticleIDs adds the "user_articles" edge to the UserArticle entity by IDs.

func (*UserCreate) AddUserArticles

func (uc *UserCreate) AddUserArticles(u ...*UserArticle) *UserCreate

AddUserArticles adds the "user_articles" edges to the UserArticle entity.

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecContext

func (c *UserCreate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

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) QueryContext

func (c *UserCreate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

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) SetCreatedAt

func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(u uuid.UUID) *UserCreate

SetID sets the "id" field.

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) SetNillableID

func (uc *UserCreate) SetNillableID(u *uuid.UUID) *UserCreate

SetNillableID sets the "id" 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) SetUpdatedAt

func (uc *UserCreate) SetUpdatedAt(t time.Time) *UserCreate

SetUpdatedAt sets the "updated_at" 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) ExecContext

func (c *UserCreateBulk) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

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) QueryContext

func (c *UserCreateBulk) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

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) ExecContext

func (c *UserDelete) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

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

func (*UserDelete) QueryContext

func (c *UserDelete) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

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

func (*UserDeleteOne) Where

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserEdges

type UserEdges struct {
	// UserArticles holds the value of the user_articles edge.
	UserArticles []*UserArticle `json:"user_articles,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserEdges) UserArticlesOrErr

func (e UserEdges) UserArticlesOrErr() ([]*UserArticle, error)

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

type UserGroupBy

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

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

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

func (*UserGroupBy) Bool

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

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

func (*UserGroupBy) BoolX

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

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

func (*UserGroupBy) Bools

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

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

func (*UserGroupBy) BoolsX

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

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

func (*UserGroupBy) Float64

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

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

func (*UserGroupBy) Float64X

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

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

func (*UserGroupBy) Float64s

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

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

func (*UserGroupBy) Float64sX

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

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

func (*UserGroupBy) Int

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

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

func (*UserGroupBy) IntX

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

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

func (*UserGroupBy) Ints

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

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

func (*UserGroupBy) IntsX

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

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

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error

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

func (*UserGroupBy) ScanX

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

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

func (*UserGroupBy) String

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

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

func (*UserGroupBy) StringX

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

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

func (*UserGroupBy) Strings

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

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

func (*UserGroupBy) StringsX

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

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

type UserMutation

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

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddField

func (m *UserMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) AddUserArticleIDs

func (m *UserMutation) AddUserArticleIDs(ids ...uuid.UUID)

AddUserArticleIDs adds the "user_articles" edge to the UserArticle entity by ids.

func (*UserMutation) AddedEdges

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

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

func (*UserMutation) AddedField

func (m *UserMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) AddedFields

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

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

func (*UserMutation) AddedIDs

func (m *UserMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserMutation) ClearEdge

func (m *UserMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*UserMutation) ClearField

func (m *UserMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ClearUserArticles

func (m *UserMutation) ClearUserArticles()

ClearUserArticles clears the "user_articles" edge to the UserArticle entity.

func (*UserMutation) ClearedEdges

func (m *UserMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserMutation) ClearedFields

func (m *UserMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) CreatedAt

func (m *UserMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the 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) ExecContext

func (c *UserMutation) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserMutation) Field

func (m *UserMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) FieldCleared

func (m *UserMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserMutation) Fields

func (m *UserMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*UserMutation) ID

func (m *UserMutation) ID() (id uuid.UUID, 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) ([]uuid.UUID, 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) 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) 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) 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) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) QueryContext

func (c *UserMutation) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserMutation) RemoveUserArticleIDs

func (m *UserMutation) RemoveUserArticleIDs(ids ...uuid.UUID)

RemoveUserArticleIDs removes the "user_articles" edge to the UserArticle entity by IDs.

func (*UserMutation) RemovedEdges

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedIDs

func (m *UserMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserMutation) RemovedUserArticlesIDs

func (m *UserMutation) RemovedUserArticlesIDs() (ids []uuid.UUID)

RemovedUserArticles returns the removed IDs of the "user_articles" edge to the UserArticle entity.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" 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) 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) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserMutation) ResetUserArticles

func (m *UserMutation) ResetUserArticles()

ResetUserArticles resets all changes to the "user_articles" edge.

func (*UserMutation) SetCreatedAt

func (m *UserMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetField

func (m *UserMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) SetID

func (m *UserMutation) SetID(id uuid.UUID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of User entities.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserMutation) SetUpdatedAt

func (m *UserMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" 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) UpdatedAt

func (m *UserMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*UserMutation) UserArticlesCleared

func (m *UserMutation) UserArticlesCleared() bool

UserArticlesCleared reports if the "user_articles" edge to the UserArticle entity was cleared.

func (*UserMutation) UserArticlesIDs

func (m *UserMutation) UserArticlesIDs() (ids []uuid.UUID)

UserArticlesIDs returns the "user_articles" edge IDs in the mutation.

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP

func (m *UserMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserQuery

type UserQuery struct {
	// contains filtered or unexported fields
}

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

AllX is like All, but panics if an error occurs.

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserQuery) ExecContext

func (c *UserQuery) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

First returns the first User entity from the query. Returns a *NotFoundError when no User was found.

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id uuid.UUID, 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) uuid.UUID

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) ForShare

func (uq *UserQuery) ForShare(opts ...sql.LockOption) *UserQuery

ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock on any rows that are read. Other sessions can read the rows, but cannot modify them until your transaction commits.

func (*UserQuery) ForUpdate

func (uq *UserQuery) ForUpdate(opts ...sql.LockOption) *UserQuery

ForUpdate locks the selected rows against concurrent updates, and prevent them from being updated, deleted or "selected ... for update" by other sessions, until the transaction is either committed or rolled-back.

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:"created_at,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) (ids []uuid.UUID, err error)

IDs executes the query and returns a list of User IDs.

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []uuid.UUID

IDsX is like IDs, but panics if an error occurs.

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit the number of records to be returned by this query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id uuid.UUID, 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) uuid.UUID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

OnlyX is like Only, but panics if an error occurs.

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) QueryContext

func (c *UserQuery) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserQuery) QueryUserArticles

func (uq *UserQuery) QueryUserArticles() *UserArticleQuery

QueryUserArticles chains the current query on the "user_articles" 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:"created_at,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) WithUserArticles

func (uq *UserQuery) WithUserArticles(opts ...func(*UserArticleQuery)) *UserQuery

WithUserArticles tells the query-builder to eager-load the nodes that are connected to the "user_articles" edge. The optional arguments are used to configure the query builder of the edge.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

func (s *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolX

func (s *UserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSelect) Bools

func (s *UserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolsX

func (s *UserSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (UserSelect) ExecContext

func (c UserSelect) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

func (*UserSelect) Float64

func (s *UserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64X

func (s *UserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSelect) Float64s

func (s *UserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64sX

func (s *UserSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSelect) Int

func (s *UserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntX

func (s *UserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSelect) Ints

func (s *UserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntsX

func (s *UserSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (UserSelect) QueryContext

func (c UserSelect) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v any) error

Scan applies the selector query and scans the result into the given value.

func (*UserSelect) ScanX

func (s *UserSelect) ScanX(ctx context.Context, v any)

ScanX is like Scan, but panics if an error occurs.

func (*UserSelect) String

func (s *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX

func (s *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings

func (s *UserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringsX

func (s *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserUpdate

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddUserArticleIDs

func (uu *UserUpdate) AddUserArticleIDs(ids ...uuid.UUID) *UserUpdate

AddUserArticleIDs adds the "user_articles" edge to the UserArticle entity by IDs.

func (*UserUpdate) AddUserArticles

func (uu *UserUpdate) AddUserArticles(u ...*UserArticle) *UserUpdate

AddUserArticles adds the "user_articles" edges to the UserArticle entity.

func (*UserUpdate) ClearUserArticles

func (uu *UserUpdate) ClearUserArticles() *UserUpdate

ClearUserArticles clears all "user_articles" edges to the UserArticle entity.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecContext

func (c *UserUpdate) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

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) QueryContext

func (c *UserUpdate) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserUpdate) RemoveUserArticleIDs

func (uu *UserUpdate) RemoveUserArticleIDs(ids ...uuid.UUID) *UserUpdate

RemoveUserArticleIDs removes the "user_articles" edge to UserArticle entities by IDs.

func (*UserUpdate) RemoveUserArticles

func (uu *UserUpdate) RemoveUserArticles(u ...*UserArticle) *UserUpdate

RemoveUserArticles removes "user_articles" edges to UserArticle 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) SetCreatedAt

func (uu *UserUpdate) SetCreatedAt(t time.Time) *UserUpdate

SetCreatedAt sets the "created_at" field.

func (*UserUpdate) SetNillableCreatedAt

func (uu *UserUpdate) SetNillableCreatedAt(t *time.Time) *UserUpdate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserUpdate) SetUpdatedAt

func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate

SetUpdatedAt sets the "updated_at" 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) AddUserArticleIDs

func (uuo *UserUpdateOne) AddUserArticleIDs(ids ...uuid.UUID) *UserUpdateOne

AddUserArticleIDs adds the "user_articles" edge to the UserArticle entity by IDs.

func (*UserUpdateOne) AddUserArticles

func (uuo *UserUpdateOne) AddUserArticles(u ...*UserArticle) *UserUpdateOne

AddUserArticles adds the "user_articles" edges to the UserArticle entity.

func (*UserUpdateOne) ClearUserArticles

func (uuo *UserUpdateOne) ClearUserArticles() *UserUpdateOne

ClearUserArticles clears all "user_articles" edges to the UserArticle entity.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecContext

func (c *UserUpdateOne) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error)

ExecContext allows calling the underlying ExecContext method of the driver if it is supported by it. See, database/sql#DB.ExecContext for more information.

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) QueryContext

func (c *UserUpdateOne) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error)

QueryContext allows calling the underlying QueryContext method of the driver if it is supported by it. See, database/sql#DB.QueryContext for more information.

func (*UserUpdateOne) RemoveUserArticleIDs

func (uuo *UserUpdateOne) RemoveUserArticleIDs(ids ...uuid.UUID) *UserUpdateOne

RemoveUserArticleIDs removes the "user_articles" edge to UserArticle entities by IDs.

func (*UserUpdateOne) RemoveUserArticles

func (uuo *UserUpdateOne) RemoveUserArticles(u ...*UserArticle) *UserUpdateOne

RemoveUserArticles removes "user_articles" edges to UserArticle 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) SetCreatedAt

func (uuo *UserUpdateOne) SetCreatedAt(t time.Time) *UserUpdateOne

SetCreatedAt sets the "created_at" field.

func (*UserUpdateOne) SetNillableCreatedAt

func (uuo *UserUpdateOne) SetNillableCreatedAt(t *time.Time) *UserUpdateOne

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserUpdateOne) SetUpdatedAt

func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdateOne) Where

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type UserUpsert

type UserUpsert struct {
	*sql.UpdateSet
}

UserUpsert is the "OnConflict" setter.

func (*UserUpsert) SetCreatedAt

func (u *UserUpsert) SetCreatedAt(v time.Time) *UserUpsert

SetCreatedAt sets the "created_at" field.

func (*UserUpsert) SetUpdatedAt

func (u *UserUpsert) SetUpdatedAt(v time.Time) *UserUpsert

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsert) UpdateCreatedAt

func (u *UserUpsert) UpdateCreatedAt() *UserUpsert

UpdateCreatedAt sets the "created_at" 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.

type UserUpsertBulk

type UserUpsertBulk struct {
	// contains filtered or unexported fields
}

UserUpsertBulk is the builder for "upsert"-ing a bulk of User nodes.

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) SetCreatedAt

func (u *UserUpsertBulk) SetCreatedAt(v time.Time) *UserUpsertBulk

SetCreatedAt sets the "created_at" field.

func (*UserUpsertBulk) SetUpdatedAt

func (u *UserUpsertBulk) SetUpdatedAt(v time.Time) *UserUpsertBulk

SetUpdatedAt sets the "updated_at" 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) UpdateCreatedAt

func (u *UserUpsertBulk) UpdateCreatedAt() *UserUpsertBulk

UpdateCreatedAt sets the "created_at" 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(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(user.FieldID)
		}),
	).
	Exec(ctx)

func (*UserUpsertBulk) UpdateUpdatedAt

func (u *UserUpsertBulk) UpdateUpdatedAt() *UserUpsertBulk

UpdateUpdatedAt sets the "updated_at" 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) 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 uuid.UUID, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*UserUpsertOne) IDX

func (u *UserUpsertOne) IDX(ctx context.Context) uuid.UUID

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) SetCreatedAt

func (u *UserUpsertOne) SetCreatedAt(v time.Time) *UserUpsertOne

SetCreatedAt sets the "created_at" field.

func (*UserUpsertOne) SetUpdatedAt

func (u *UserUpsertOne) SetUpdatedAt(v time.Time) *UserUpsertOne

SetUpdatedAt sets the "updated_at" 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) UpdateCreatedAt

func (u *UserUpsertOne) UpdateCreatedAt() *UserUpsertOne

UpdateCreatedAt sets the "created_at" 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 except the ID field. Using this option is equivalent to using:

client.User.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(user.FieldID)
		}),
	).
	Exec(ctx)

func (*UserUpsertOne) UpdateUpdatedAt

func (u *UserUpsertOne) UpdateUpdatedAt() *UserUpsertOne

UpdateUpdatedAt sets the "updated_at" 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