ent

package
v0.0.0-...-46fdcb5 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 23 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"
	TypeReadArticle = "ReadArticle"
	TypeUser        = "User"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type 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"`
	// DeletedAt holds the value of the "deleted_at" field.
	DeletedAt *time.Time `json:"deleted_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) QueryReadArticles

func (a *Article) QueryReadArticles() *ReadArticleQuery

QueryReadArticles queries the "read_articles" edge of the Article entity.

func (*Article) QueryTags

func (a *Article) QueryTags() *ArticleTagQuery

QueryTags queries the "tags" 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.

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) 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) QueryReadArticles

func (c *ArticleClient) QueryReadArticles(a *Article) *ReadArticleQuery

QueryReadArticles queries the read_articles edge of a Article.

func (*ArticleClient) QueryTags

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

QueryTags queries the tags 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) AddReadArticleIDs

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

AddReadArticleIDs adds the "read_articles" edge to the ReadArticle entity by IDs.

func (*ArticleCreate) AddReadArticles

func (ac *ArticleCreate) AddReadArticles(r ...*ReadArticle) *ArticleCreate

AddReadArticles adds the "read_articles" edges to the ReadArticle 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) Exec

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

Exec executes the query.

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) 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) SetDeletedAt

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

SetDeletedAt sets the "deleted_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) SetNillableDeletedAt

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

SetNillableDeletedAt sets the "deleted_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) 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) 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) ExecX

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

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

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"`
	// ReadArticles holds the value of the read_articles edge.
	ReadArticles []*ReadArticle `json:"read_articles,omitempty"`
	// contains filtered or unexported fields
}

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

func (ArticleEdges) ReadArticlesOrErr

func (e ArticleEdges) ReadArticlesOrErr() ([]*ReadArticle, error)

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

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.

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) AddReadArticleIDs

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

AddReadArticleIDs adds the "read_articles" edge to the ReadArticle entity by ids.

func (*ArticleMutation) AddTagIDs

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

AddTagIDs adds the "tags" edge to the ArticleTag 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) ClearDeletedAt

func (m *ArticleMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

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) ClearReadArticles

func (m *ArticleMutation) ClearReadArticles()

ClearReadArticles clears the "read_articles" edge to the ReadArticle entity.

func (*ArticleMutation) ClearTags

func (m *ArticleMutation) ClearTags()

ClearTags clears the "tags" edge to the ArticleTag 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) DeletedAt

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

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

func (*ArticleMutation) DeletedAtCleared

func (m *ArticleMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this 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) 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) OldDeletedAt

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

OldDeletedAt returns the old "deleted_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) ReadArticlesCleared

func (m *ArticleMutation) ReadArticlesCleared() bool

ReadArticlesCleared reports if the "read_articles" edge to the ReadArticle entity was cleared.

func (*ArticleMutation) ReadArticlesIDs

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

ReadArticlesIDs returns the "read_articles" edge IDs in the mutation.

func (*ArticleMutation) RemoveReadArticleIDs

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

RemoveReadArticleIDs removes the "read_articles" edge to the ReadArticle entity by IDs.

func (*ArticleMutation) RemoveTagIDs

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

RemoveTagIDs removes the "tags" edge to the ArticleTag 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) RemovedReadArticlesIDs

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

RemovedReadArticles returns the removed IDs of the "read_articles" edge to the ReadArticle entity.

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) ResetCreatedAt

func (m *ArticleMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ArticleMutation) ResetDeletedAt

func (m *ArticleMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_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) ResetReadArticles

func (m *ArticleMutation) ResetReadArticles()

ResetReadArticles resets all changes to the "read_articles" edge.

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) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ArticleMutation) SetDeletedAt

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

SetDeletedAt sets the "deleted_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) 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) 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) 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 ...OrderFunc) *ArticleQuery

Order specifies how the records should be ordered.

func (*ArticleQuery) QueryReadArticles

func (aq *ArticleQuery) QueryReadArticles() *ReadArticleQuery

QueryReadArticles chains the current query on the "read_articles" edge.

func (*ArticleQuery) QueryTags

func (aq *ArticleQuery) QueryTags() *ArticleTagQuery

QueryTags chains the current query on the "tags" 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) WithReadArticles

func (aq *ArticleQuery) WithReadArticles(opts ...func(*ReadArticleQuery)) *ArticleQuery

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

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.

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) 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) 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"`
	// 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 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) QueryArticle

func (at *ArticleTag) QueryArticle() *ArticleQuery

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

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.

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) 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) 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) 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) 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) SetCreatedAt

func (atc *ArticleTagCreate) SetCreatedAt(t time.Time) *ArticleTagCreate

SetCreatedAt sets the "created_at" field.

func (*ArticleTagCreate) SetID

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

SetID sets the "id" field.

func (*ArticleTagCreate) SetNillableCreatedAt

func (atc *ArticleTagCreate) SetNillableCreatedAt(t *time.Time) *ArticleTagCreate

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

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) SetNillableUpdatedAt

func (atc *ArticleTagCreate) SetNillableUpdatedAt(t *time.Time) *ArticleTagCreate

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

func (*ArticleTagCreate) SetTag

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

SetTag sets the "tag" field.

func (*ArticleTagCreate) SetUpdatedAt

func (atc *ArticleTagCreate) SetUpdatedAt(t time.Time) *ArticleTagCreate

SetUpdatedAt sets the "updated_at" 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) 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) 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) ExecX

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

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

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) CreatedAt

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

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

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) 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) OldCreatedAt

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

OldCreatedAt returns the old "created_at" 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) OldUpdatedAt

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

OldUpdatedAt returns the old "updated_at" 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) 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) ResetCreatedAt

func (m *ArticleTagMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" 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) ResetUpdatedAt

func (m *ArticleTagMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*ArticleTagMutation) SetArticleID

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

SetArticleID sets the "article_id" field.

func (*ArticleTagMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" 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) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" 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) UpdatedAt

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

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

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) 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) 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

func (atq *ArticleTagQuery) Order(o ...OrderFunc) *ArticleTagQuery

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) 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) 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) 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) 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) 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) SetCreatedAt

func (atu *ArticleTagUpdate) SetCreatedAt(t time.Time) *ArticleTagUpdate

SetCreatedAt sets the "created_at" field.

func (*ArticleTagUpdate) SetNillableCreatedAt

func (atu *ArticleTagUpdate) SetNillableCreatedAt(t *time.Time) *ArticleTagUpdate

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

func (*ArticleTagUpdate) SetTag

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

SetTag sets the "tag" field.

func (*ArticleTagUpdate) SetUpdatedAt

func (atu *ArticleTagUpdate) SetUpdatedAt(t time.Time) *ArticleTagUpdate

SetUpdatedAt sets the "updated_at" 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) 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) 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) SetCreatedAt

func (atuo *ArticleTagUpdateOne) SetCreatedAt(t time.Time) *ArticleTagUpdateOne

SetCreatedAt sets the "created_at" field.

func (*ArticleTagUpdateOne) SetNillableCreatedAt

func (atuo *ArticleTagUpdateOne) SetNillableCreatedAt(t *time.Time) *ArticleTagUpdateOne

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

func (*ArticleTagUpdateOne) SetTag

SetTag sets the "tag" field.

func (*ArticleTagUpdateOne) SetUpdatedAt

func (atuo *ArticleTagUpdateOne) SetUpdatedAt(t time.Time) *ArticleTagUpdateOne

SetUpdatedAt sets the "updated_at" 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) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ArticleTagUpsert) SetTag

SetTag sets the "tag" field.

func (*ArticleTagUpsert) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" 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) UpdateCreatedAt

func (u *ArticleTagUpsert) UpdateCreatedAt() *ArticleTagUpsert

UpdateCreatedAt sets the "created_at" 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.

func (*ArticleTagUpsert) UpdateUpdatedAt

func (u *ArticleTagUpsert) UpdateUpdatedAt() *ArticleTagUpsert

UpdateUpdatedAt sets the "updated_at" 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) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ArticleTagUpsertBulk) SetTag

SetTag sets the "tag" field.

func (*ArticleTagUpsertBulk) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" 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) UpdateCreatedAt

func (u *ArticleTagUpsertBulk) UpdateCreatedAt() *ArticleTagUpsertBulk

UpdateCreatedAt sets the "created_at" 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.

func (*ArticleTagUpsertBulk) UpdateUpdatedAt

func (u *ArticleTagUpsertBulk) UpdateUpdatedAt() *ArticleTagUpsertBulk

UpdateUpdatedAt sets the "updated_at" 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) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ArticleTagUpsertOne) SetTag

SetTag sets the "tag" field.

func (*ArticleTagUpsertOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" 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) UpdateCreatedAt

func (u *ArticleTagUpsertOne) UpdateCreatedAt() *ArticleTagUpsertOne

UpdateCreatedAt sets the "created_at" 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.

func (*ArticleTagUpsertOne) UpdateUpdatedAt

func (u *ArticleTagUpsertOne) UpdateUpdatedAt() *ArticleTagUpsertOne

UpdateUpdatedAt sets the "updated_at" 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) AddReadArticleIDs

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

AddReadArticleIDs adds the "read_articles" edge to the ReadArticle entity by IDs.

func (*ArticleUpdate) AddReadArticles

func (au *ArticleUpdate) AddReadArticles(r ...*ReadArticle) *ArticleUpdate

AddReadArticles adds the "read_articles" edges to the ReadArticle entity.

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) ClearDeletedAt

func (au *ArticleUpdate) ClearDeletedAt() *ArticleUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*ArticleUpdate) ClearReadArticles

func (au *ArticleUpdate) ClearReadArticles() *ArticleUpdate

ClearReadArticles clears all "read_articles" edges to the ReadArticle entity.

func (*ArticleUpdate) ClearTags

func (au *ArticleUpdate) ClearTags() *ArticleUpdate

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

func (*ArticleUpdate) Exec

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

Exec executes the query.

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) RemoveReadArticleIDs

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

RemoveReadArticleIDs removes the "read_articles" edge to ReadArticle entities by IDs.

func (*ArticleUpdate) RemoveReadArticles

func (au *ArticleUpdate) RemoveReadArticles(r ...*ReadArticle) *ArticleUpdate

RemoveReadArticles removes "read_articles" edges to ReadArticle entities.

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) 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) SetDeletedAt

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

SetDeletedAt sets the "deleted_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) SetNillableDeletedAt

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

SetNillableDeletedAt sets the "deleted_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) AddReadArticleIDs

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

AddReadArticleIDs adds the "read_articles" edge to the ReadArticle entity by IDs.

func (*ArticleUpdateOne) AddReadArticles

func (auo *ArticleUpdateOne) AddReadArticles(r ...*ReadArticle) *ArticleUpdateOne

AddReadArticles adds the "read_articles" edges to the ReadArticle 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) ClearDeletedAt

func (auo *ArticleUpdateOne) ClearDeletedAt() *ArticleUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*ArticleUpdateOne) ClearReadArticles

func (auo *ArticleUpdateOne) ClearReadArticles() *ArticleUpdateOne

ClearReadArticles clears all "read_articles" edges to the ReadArticle entity.

func (*ArticleUpdateOne) ClearTags

func (auo *ArticleUpdateOne) ClearTags() *ArticleUpdateOne

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

func (*ArticleUpdateOne) Exec

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

Exec executes the query on the entity.

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) RemoveReadArticleIDs

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

RemoveReadArticleIDs removes the "read_articles" edge to ReadArticle entities by IDs.

func (*ArticleUpdateOne) RemoveReadArticles

func (auo *ArticleUpdateOne) RemoveReadArticles(r ...*ReadArticle) *ArticleUpdateOne

RemoveReadArticles removes "read_articles" edges to ReadArticle entities.

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) 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) SetDeletedAt

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

SetDeletedAt sets the "deleted_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) SetNillableDeletedAt

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

SetNillableDeletedAt sets the "deleted_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) ClearDeletedAt

func (u *ArticleUpsert) ClearDeletedAt() *ArticleUpsert

ClearDeletedAt clears the value of the "deleted_at" field.

func (*ArticleUpsert) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ArticleUpsert) SetDeletedAt

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

SetDeletedAt sets the "deleted_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) UpdateDeletedAt

func (u *ArticleUpsert) UpdateDeletedAt() *ArticleUpsert

UpdateDeletedAt sets the "deleted_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) ClearDeletedAt

func (u *ArticleUpsertBulk) ClearDeletedAt() *ArticleUpsertBulk

ClearDeletedAt clears the value of the "deleted_at" field.

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) SetDeletedAt

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

SetDeletedAt sets the "deleted_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) UpdateDeletedAt

func (u *ArticleUpsertBulk) UpdateDeletedAt() *ArticleUpsertBulk

UpdateDeletedAt sets the "deleted_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) ClearDeletedAt

func (u *ArticleUpsertOne) ClearDeletedAt() *ArticleUpsertOne

ClearDeletedAt clears the value of the "deleted_at" field.

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) SetDeletedAt

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

SetDeletedAt sets the "deleted_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) UpdateDeletedAt

func (u *ArticleUpsertOne) UpdateDeletedAt() *ArticleUpsertOne

UpdateDeletedAt sets the "deleted_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
	// ReadArticle is the client for interacting with the ReadArticle builders.
	ReadArticle *ReadArticleClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

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

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

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

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

func (*Client) BeginTx

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

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

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

func (*Client) Debug

func (c *Client) Debug() *Client

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

client.Debug().
	Article.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type 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 ReadArticle

type ReadArticle 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"`
	// ReadAt holds the value of the "read_at" field.
	ReadAt time.Time `json:"read_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ReadArticleQuery when eager-loading is set.
	Edges ReadArticleEdges `json:"edges"`
	// contains filtered or unexported fields
}

ReadArticle is the model entity for the ReadArticle schema.

func (*ReadArticle) QueryArticle

func (ra *ReadArticle) QueryArticle() *ArticleQuery

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

func (*ReadArticle) String

func (ra *ReadArticle) String() string

String implements the fmt.Stringer.

func (*ReadArticle) Unwrap

func (ra *ReadArticle) Unwrap() *ReadArticle

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

func (ra *ReadArticle) Update() *ReadArticleUpdateOne

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

type ReadArticleClient

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

ReadArticleClient is a client for the ReadArticle schema.

func NewReadArticleClient

func NewReadArticleClient(c config) *ReadArticleClient

NewReadArticleClient returns a client for the ReadArticle from the given config.

func (*ReadArticleClient) Create

func (c *ReadArticleClient) Create() *ReadArticleCreate

Create returns a builder for creating a ReadArticle entity.

func (*ReadArticleClient) CreateBulk

func (c *ReadArticleClient) CreateBulk(builders ...*ReadArticleCreate) *ReadArticleCreateBulk

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

func (*ReadArticleClient) Delete

func (c *ReadArticleClient) Delete() *ReadArticleDelete

Delete returns a delete builder for ReadArticle.

func (*ReadArticleClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ReadArticleClient) DeleteOneID

func (c *ReadArticleClient) DeleteOneID(id uuid.UUID) *ReadArticleDeleteOne

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

func (*ReadArticleClient) Get

Get returns a ReadArticle entity by its id.

func (*ReadArticleClient) GetX

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

func (*ReadArticleClient) Hooks

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

Hooks returns the client hooks.

func (*ReadArticleClient) Intercept

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

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

func (*ReadArticleClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ReadArticleClient) Query

func (c *ReadArticleClient) Query() *ReadArticleQuery

Query returns a query builder for ReadArticle.

func (*ReadArticleClient) QueryArticle

func (c *ReadArticleClient) QueryArticle(ra *ReadArticle) *ArticleQuery

QueryArticle queries the article edge of a ReadArticle.

func (*ReadArticleClient) Update

func (c *ReadArticleClient) Update() *ReadArticleUpdate

Update returns an update builder for ReadArticle.

func (*ReadArticleClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*ReadArticleClient) UpdateOneID

func (c *ReadArticleClient) UpdateOneID(id uuid.UUID) *ReadArticleUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ReadArticleClient) Use

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

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

type ReadArticleCreate

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

ReadArticleCreate is the builder for creating a ReadArticle entity.

func (*ReadArticleCreate) Exec

func (rac *ReadArticleCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ReadArticleCreate) ExecX

func (rac *ReadArticleCreate) ExecX(ctx context.Context)

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

func (*ReadArticleCreate) Mutation

func (rac *ReadArticleCreate) Mutation() *ReadArticleMutation

Mutation returns the ReadArticleMutation object of the builder.

func (*ReadArticleCreate) OnConflict

func (rac *ReadArticleCreate) OnConflict(opts ...sql.ConflictOption) *ReadArticleUpsertOne

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

client.ReadArticle.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.ReadArticleUpsert) {
		SetArticleID(v+v).
	}).
	Exec(ctx)

func (*ReadArticleCreate) OnConflictColumns

func (rac *ReadArticleCreate) OnConflictColumns(columns ...string) *ReadArticleUpsertOne

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

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

func (*ReadArticleCreate) Save

func (rac *ReadArticleCreate) Save(ctx context.Context) (*ReadArticle, error)

Save creates the ReadArticle in the database.

func (*ReadArticleCreate) SaveX

func (rac *ReadArticleCreate) SaveX(ctx context.Context) *ReadArticle

SaveX calls Save and panics if Save returns an error.

func (*ReadArticleCreate) SetArticle

func (rac *ReadArticleCreate) SetArticle(a *Article) *ReadArticleCreate

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

func (*ReadArticleCreate) SetArticleID

func (rac *ReadArticleCreate) SetArticleID(u uuid.UUID) *ReadArticleCreate

SetArticleID sets the "article_id" field.

func (*ReadArticleCreate) SetID

SetID sets the "id" field.

func (*ReadArticleCreate) SetNillableID

func (rac *ReadArticleCreate) SetNillableID(u *uuid.UUID) *ReadArticleCreate

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

func (*ReadArticleCreate) SetNillableReadAt

func (rac *ReadArticleCreate) SetNillableReadAt(t *time.Time) *ReadArticleCreate

SetNillableReadAt sets the "read_at" field if the given value is not nil.

func (*ReadArticleCreate) SetReadAt

func (rac *ReadArticleCreate) SetReadAt(t time.Time) *ReadArticleCreate

SetReadAt sets the "read_at" field.

func (*ReadArticleCreate) SetUserID

func (rac *ReadArticleCreate) SetUserID(u uuid.UUID) *ReadArticleCreate

SetUserID sets the "user_id" field.

type ReadArticleCreateBulk

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

ReadArticleCreateBulk is the builder for creating many ReadArticle entities in bulk.

func (*ReadArticleCreateBulk) Exec

func (racb *ReadArticleCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ReadArticleCreateBulk) ExecX

func (racb *ReadArticleCreateBulk) ExecX(ctx context.Context)

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

func (*ReadArticleCreateBulk) OnConflict

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

client.ReadArticle.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.ReadArticleUpsert) {
		SetArticleID(v+v).
	}).
	Exec(ctx)

func (*ReadArticleCreateBulk) OnConflictColumns

func (racb *ReadArticleCreateBulk) OnConflictColumns(columns ...string) *ReadArticleUpsertBulk

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

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

func (*ReadArticleCreateBulk) Save

func (racb *ReadArticleCreateBulk) Save(ctx context.Context) ([]*ReadArticle, error)

Save creates the ReadArticle entities in the database.

func (*ReadArticleCreateBulk) SaveX

func (racb *ReadArticleCreateBulk) SaveX(ctx context.Context) []*ReadArticle

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

type ReadArticleDelete

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

ReadArticleDelete is the builder for deleting a ReadArticle entity.

func (*ReadArticleDelete) Exec

func (rad *ReadArticleDelete) Exec(ctx context.Context) (int, error)

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

func (*ReadArticleDelete) ExecX

func (rad *ReadArticleDelete) ExecX(ctx context.Context) int

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

func (*ReadArticleDelete) Where

Where appends a list predicates to the ReadArticleDelete builder.

type ReadArticleDeleteOne

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

ReadArticleDeleteOne is the builder for deleting a single ReadArticle entity.

func (*ReadArticleDeleteOne) Exec

func (rado *ReadArticleDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ReadArticleDeleteOne) ExecX

func (rado *ReadArticleDeleteOne) ExecX(ctx context.Context)

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

func (*ReadArticleDeleteOne) Where

Where appends a list predicates to the ReadArticleDelete builder.

type ReadArticleEdges

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

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

func (ReadArticleEdges) ArticleOrErr

func (e ReadArticleEdges) 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 ReadArticleGroupBy

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

ReadArticleGroupBy is the group-by builder for ReadArticle entities.

func (*ReadArticleGroupBy) Aggregate

func (ragb *ReadArticleGroupBy) Aggregate(fns ...AggregateFunc) *ReadArticleGroupBy

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

func (*ReadArticleGroupBy) Bool

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

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

func (*ReadArticleGroupBy) BoolX

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

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

func (*ReadArticleGroupBy) Bools

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

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

func (*ReadArticleGroupBy) BoolsX

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

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

func (*ReadArticleGroupBy) Float64

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

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

func (*ReadArticleGroupBy) Float64X

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

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

func (*ReadArticleGroupBy) Float64s

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

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

func (*ReadArticleGroupBy) Float64sX

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

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

func (*ReadArticleGroupBy) Int

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

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

func (*ReadArticleGroupBy) IntX

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

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

func (*ReadArticleGroupBy) Ints

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

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

func (*ReadArticleGroupBy) IntsX

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

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

func (*ReadArticleGroupBy) Scan

func (ragb *ReadArticleGroupBy) Scan(ctx context.Context, v any) error

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

func (*ReadArticleGroupBy) ScanX

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

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

func (*ReadArticleGroupBy) String

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

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

func (*ReadArticleGroupBy) StringX

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

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

func (*ReadArticleGroupBy) Strings

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

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

func (*ReadArticleGroupBy) StringsX

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

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

type ReadArticleMutation

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

ReadArticleMutation represents an operation that mutates the ReadArticle nodes in the graph.

func (*ReadArticleMutation) AddField

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

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

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

func (*ReadArticleMutation) AddedField

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

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

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

func (*ReadArticleMutation) AddedIDs

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

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

func (*ReadArticleMutation) ArticleCleared

func (m *ReadArticleMutation) ArticleCleared() bool

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

func (*ReadArticleMutation) ArticleID

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

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

func (*ReadArticleMutation) ArticleIDs

func (m *ReadArticleMutation) 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 (*ReadArticleMutation) ClearArticle

func (m *ReadArticleMutation) ClearArticle()

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

func (*ReadArticleMutation) ClearEdge

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

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

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

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

func (*ReadArticleMutation) ClearedFields

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

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

func (ReadArticleMutation) Client

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

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

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

func (*ReadArticleMutation) Field

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

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

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

func (*ReadArticleMutation) Fields

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

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

func (m *ReadArticleMutation) 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 (*ReadArticleMutation) OldArticleID

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

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

func (m *ReadArticleMutation) 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 (*ReadArticleMutation) OldReadAt

func (m *ReadArticleMutation) OldReadAt(ctx context.Context) (v time.Time, err error)

OldReadAt returns the old "read_at" field's value of the ReadArticle entity. If the ReadArticle 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 (*ReadArticleMutation) OldUserID

func (m *ReadArticleMutation) OldUserID(ctx context.Context) (v uuid.UUID, err error)

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

func (m *ReadArticleMutation) Op() Op

Op returns the operation name.

func (*ReadArticleMutation) ReadAt

func (m *ReadArticleMutation) ReadAt() (r time.Time, exists bool)

ReadAt returns the value of the "read_at" field in the mutation.

func (*ReadArticleMutation) RemovedEdges

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

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

func (*ReadArticleMutation) RemovedIDs

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

func (m *ReadArticleMutation) ResetArticle()

ResetArticle resets all changes to the "article" edge.

func (*ReadArticleMutation) ResetArticleID

func (m *ReadArticleMutation) ResetArticleID()

ResetArticleID resets all changes to the "article_id" field.

func (*ReadArticleMutation) ResetEdge

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

func (m *ReadArticleMutation) 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 (*ReadArticleMutation) ResetReadAt

func (m *ReadArticleMutation) ResetReadAt()

ResetReadAt resets all changes to the "read_at" field.

func (*ReadArticleMutation) ResetUserID

func (m *ReadArticleMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*ReadArticleMutation) SetArticleID

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

SetArticleID sets the "article_id" field.

func (*ReadArticleMutation) SetField

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

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

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

func (*ReadArticleMutation) SetOp

func (m *ReadArticleMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ReadArticleMutation) SetReadAt

func (m *ReadArticleMutation) SetReadAt(t time.Time)

SetReadAt sets the "read_at" field.

func (*ReadArticleMutation) SetUserID

func (m *ReadArticleMutation) SetUserID(u uuid.UUID)

SetUserID sets the "user_id" field.

func (ReadArticleMutation) Tx

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

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

func (*ReadArticleMutation) Type

func (m *ReadArticleMutation) Type() string

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

func (*ReadArticleMutation) UserID

func (m *ReadArticleMutation) UserID() (r uuid.UUID, exists bool)

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

func (*ReadArticleMutation) Where

func (m *ReadArticleMutation) Where(ps ...predicate.ReadArticle)

Where appends a list predicates to the ReadArticleMutation builder.

func (*ReadArticleMutation) WhereP

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

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

type ReadArticleQuery

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

ReadArticleQuery is the builder for querying ReadArticle entities.

func (*ReadArticleQuery) Aggregate

func (raq *ReadArticleQuery) Aggregate(fns ...AggregateFunc) *ReadArticleSelect

Aggregate returns a ReadArticleSelect configured with the given aggregations.

func (*ReadArticleQuery) All

func (raq *ReadArticleQuery) All(ctx context.Context) ([]*ReadArticle, error)

All executes the query and returns a list of ReadArticles.

func (*ReadArticleQuery) AllX

func (raq *ReadArticleQuery) AllX(ctx context.Context) []*ReadArticle

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

func (*ReadArticleQuery) Clone

func (raq *ReadArticleQuery) Clone() *ReadArticleQuery

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

func (*ReadArticleQuery) Count

func (raq *ReadArticleQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ReadArticleQuery) CountX

func (raq *ReadArticleQuery) CountX(ctx context.Context) int

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

func (*ReadArticleQuery) Exist

func (raq *ReadArticleQuery) Exist(ctx context.Context) (bool, error)

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

func (*ReadArticleQuery) ExistX

func (raq *ReadArticleQuery) ExistX(ctx context.Context) bool

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

func (*ReadArticleQuery) First

func (raq *ReadArticleQuery) First(ctx context.Context) (*ReadArticle, error)

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

func (*ReadArticleQuery) FirstID

func (raq *ReadArticleQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ReadArticleQuery) FirstIDX

func (raq *ReadArticleQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*ReadArticleQuery) FirstX

func (raq *ReadArticleQuery) FirstX(ctx context.Context) *ReadArticle

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

func (*ReadArticleQuery) GroupBy

func (raq *ReadArticleQuery) GroupBy(field string, fields ...string) *ReadArticleGroupBy

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.ReadArticle.Query().
	GroupBy(readarticle.FieldArticleID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ReadArticleQuery) IDs

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

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

func (*ReadArticleQuery) IDsX

func (raq *ReadArticleQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*ReadArticleQuery) Limit

func (raq *ReadArticleQuery) Limit(limit int) *ReadArticleQuery

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

func (*ReadArticleQuery) Offset

func (raq *ReadArticleQuery) Offset(offset int) *ReadArticleQuery

Offset to start from.

func (*ReadArticleQuery) Only

func (raq *ReadArticleQuery) Only(ctx context.Context) (*ReadArticle, error)

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

func (*ReadArticleQuery) OnlyID

func (raq *ReadArticleQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ReadArticleQuery) OnlyIDX

func (raq *ReadArticleQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*ReadArticleQuery) OnlyX

func (raq *ReadArticleQuery) OnlyX(ctx context.Context) *ReadArticle

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

func (*ReadArticleQuery) Order

func (raq *ReadArticleQuery) Order(o ...OrderFunc) *ReadArticleQuery

Order specifies how the records should be ordered.

func (*ReadArticleQuery) QueryArticle

func (raq *ReadArticleQuery) QueryArticle() *ArticleQuery

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

func (*ReadArticleQuery) Select

func (raq *ReadArticleQuery) Select(fields ...string) *ReadArticleSelect

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.ReadArticle.Query().
	Select(readarticle.FieldArticleID).
	Scan(ctx, &v)

func (*ReadArticleQuery) Unique

func (raq *ReadArticleQuery) Unique(unique bool) *ReadArticleQuery

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

Where adds a new predicate for the ReadArticleQuery builder.

func (*ReadArticleQuery) WithArticle

func (raq *ReadArticleQuery) WithArticle(opts ...func(*ArticleQuery)) *ReadArticleQuery

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 ReadArticleSelect

type ReadArticleSelect struct {
	*ReadArticleQuery
	// contains filtered or unexported fields
}

ReadArticleSelect is the builder for selecting fields of ReadArticle entities.

func (*ReadArticleSelect) Aggregate

func (ras *ReadArticleSelect) Aggregate(fns ...AggregateFunc) *ReadArticleSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ReadArticleSelect) Bool

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

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

func (*ReadArticleSelect) BoolX

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

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

func (*ReadArticleSelect) Bools

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

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

func (*ReadArticleSelect) BoolsX

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

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

func (*ReadArticleSelect) Float64

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

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

func (*ReadArticleSelect) Float64X

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

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

func (*ReadArticleSelect) Float64s

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

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

func (*ReadArticleSelect) Float64sX

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

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

func (*ReadArticleSelect) Int

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

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

func (*ReadArticleSelect) IntX

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

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

func (*ReadArticleSelect) Ints

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

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

func (*ReadArticleSelect) IntsX

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

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

func (*ReadArticleSelect) Scan

func (ras *ReadArticleSelect) Scan(ctx context.Context, v any) error

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

func (*ReadArticleSelect) ScanX

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

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

func (*ReadArticleSelect) String

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

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

func (*ReadArticleSelect) StringX

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

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

func (*ReadArticleSelect) Strings

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

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

func (*ReadArticleSelect) StringsX

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

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

type ReadArticleUpdate

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

ReadArticleUpdate is the builder for updating ReadArticle entities.

func (*ReadArticleUpdate) ClearArticle

func (rau *ReadArticleUpdate) ClearArticle() *ReadArticleUpdate

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

func (*ReadArticleUpdate) Exec

func (rau *ReadArticleUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ReadArticleUpdate) ExecX

func (rau *ReadArticleUpdate) ExecX(ctx context.Context)

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

func (*ReadArticleUpdate) Mutation

func (rau *ReadArticleUpdate) Mutation() *ReadArticleMutation

Mutation returns the ReadArticleMutation object of the builder.

func (*ReadArticleUpdate) Save

func (rau *ReadArticleUpdate) Save(ctx context.Context) (int, error)

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

func (*ReadArticleUpdate) SaveX

func (rau *ReadArticleUpdate) SaveX(ctx context.Context) int

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

func (*ReadArticleUpdate) SetArticle

func (rau *ReadArticleUpdate) SetArticle(a *Article) *ReadArticleUpdate

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

func (*ReadArticleUpdate) SetArticleID

func (rau *ReadArticleUpdate) SetArticleID(u uuid.UUID) *ReadArticleUpdate

SetArticleID sets the "article_id" field.

func (*ReadArticleUpdate) SetNillableReadAt

func (rau *ReadArticleUpdate) SetNillableReadAt(t *time.Time) *ReadArticleUpdate

SetNillableReadAt sets the "read_at" field if the given value is not nil.

func (*ReadArticleUpdate) SetReadAt

func (rau *ReadArticleUpdate) SetReadAt(t time.Time) *ReadArticleUpdate

SetReadAt sets the "read_at" field.

func (*ReadArticleUpdate) SetUserID

func (rau *ReadArticleUpdate) SetUserID(u uuid.UUID) *ReadArticleUpdate

SetUserID sets the "user_id" field.

func (*ReadArticleUpdate) Where

Where appends a list predicates to the ReadArticleUpdate builder.

type ReadArticleUpdateOne

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

ReadArticleUpdateOne is the builder for updating a single ReadArticle entity.

func (*ReadArticleUpdateOne) ClearArticle

func (rauo *ReadArticleUpdateOne) ClearArticle() *ReadArticleUpdateOne

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

func (*ReadArticleUpdateOne) Exec

func (rauo *ReadArticleUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ReadArticleUpdateOne) ExecX

func (rauo *ReadArticleUpdateOne) ExecX(ctx context.Context)

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

func (*ReadArticleUpdateOne) Mutation

func (rauo *ReadArticleUpdateOne) Mutation() *ReadArticleMutation

Mutation returns the ReadArticleMutation object of the builder.

func (*ReadArticleUpdateOne) Save

Save executes the query and returns the updated ReadArticle entity.

func (*ReadArticleUpdateOne) SaveX

func (rauo *ReadArticleUpdateOne) SaveX(ctx context.Context) *ReadArticle

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

func (*ReadArticleUpdateOne) Select

func (rauo *ReadArticleUpdateOne) Select(field string, fields ...string) *ReadArticleUpdateOne

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

func (*ReadArticleUpdateOne) SetArticle

func (rauo *ReadArticleUpdateOne) SetArticle(a *Article) *ReadArticleUpdateOne

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

func (*ReadArticleUpdateOne) SetArticleID

func (rauo *ReadArticleUpdateOne) SetArticleID(u uuid.UUID) *ReadArticleUpdateOne

SetArticleID sets the "article_id" field.

func (*ReadArticleUpdateOne) SetNillableReadAt

func (rauo *ReadArticleUpdateOne) SetNillableReadAt(t *time.Time) *ReadArticleUpdateOne

SetNillableReadAt sets the "read_at" field if the given value is not nil.

func (*ReadArticleUpdateOne) SetReadAt

func (rauo *ReadArticleUpdateOne) SetReadAt(t time.Time) *ReadArticleUpdateOne

SetReadAt sets the "read_at" field.

func (*ReadArticleUpdateOne) SetUserID

func (rauo *ReadArticleUpdateOne) SetUserID(u uuid.UUID) *ReadArticleUpdateOne

SetUserID sets the "user_id" field.

func (*ReadArticleUpdateOne) Where

Where appends a list predicates to the ReadArticleUpdate builder.

type ReadArticleUpsert

type ReadArticleUpsert struct {
	*sql.UpdateSet
}

ReadArticleUpsert is the "OnConflict" setter.

func (*ReadArticleUpsert) SetArticleID

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

SetArticleID sets the "article_id" field.

func (*ReadArticleUpsert) SetReadAt

func (u *ReadArticleUpsert) SetReadAt(v time.Time) *ReadArticleUpsert

SetReadAt sets the "read_at" field.

func (*ReadArticleUpsert) SetUserID

func (u *ReadArticleUpsert) SetUserID(v uuid.UUID) *ReadArticleUpsert

SetUserID sets the "user_id" field.

func (*ReadArticleUpsert) UpdateArticleID

func (u *ReadArticleUpsert) UpdateArticleID() *ReadArticleUpsert

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

func (*ReadArticleUpsert) UpdateReadAt

func (u *ReadArticleUpsert) UpdateReadAt() *ReadArticleUpsert

UpdateReadAt sets the "read_at" field to the value that was provided on create.

func (*ReadArticleUpsert) UpdateUserID

func (u *ReadArticleUpsert) UpdateUserID() *ReadArticleUpsert

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

type ReadArticleUpsertBulk

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

ReadArticleUpsertBulk is the builder for "upsert"-ing a bulk of ReadArticle nodes.

func (*ReadArticleUpsertBulk) DoNothing

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

func (*ReadArticleUpsertBulk) Exec

Exec executes the query.

func (*ReadArticleUpsertBulk) ExecX

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

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

func (*ReadArticleUpsertBulk) Ignore

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

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

func (*ReadArticleUpsertBulk) SetArticleID

SetArticleID sets the "article_id" field.

func (*ReadArticleUpsertBulk) SetReadAt

SetReadAt sets the "read_at" field.

func (*ReadArticleUpsertBulk) SetUserID

SetUserID sets the "user_id" field.

func (*ReadArticleUpsertBulk) Update

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

func (*ReadArticleUpsertBulk) UpdateArticleID

func (u *ReadArticleUpsertBulk) UpdateArticleID() *ReadArticleUpsertBulk

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

func (*ReadArticleUpsertBulk) UpdateNewValues

func (u *ReadArticleUpsertBulk) UpdateNewValues() *ReadArticleUpsertBulk

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

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

func (*ReadArticleUpsertBulk) UpdateReadAt

func (u *ReadArticleUpsertBulk) UpdateReadAt() *ReadArticleUpsertBulk

UpdateReadAt sets the "read_at" field to the value that was provided on create.

func (*ReadArticleUpsertBulk) UpdateUserID

func (u *ReadArticleUpsertBulk) UpdateUserID() *ReadArticleUpsertBulk

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

type ReadArticleUpsertOne

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

ReadArticleUpsertOne is the builder for "upsert"-ing

one ReadArticle node.

func (*ReadArticleUpsertOne) DoNothing

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

func (*ReadArticleUpsertOne) Exec

Exec executes the query.

func (*ReadArticleUpsertOne) ExecX

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

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

func (*ReadArticleUpsertOne) ID

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

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

func (*ReadArticleUpsertOne) IDX

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

func (*ReadArticleUpsertOne) Ignore

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

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

func (*ReadArticleUpsertOne) SetArticleID

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

SetArticleID sets the "article_id" field.

func (*ReadArticleUpsertOne) SetReadAt

SetReadAt sets the "read_at" field.

func (*ReadArticleUpsertOne) SetUserID

SetUserID sets the "user_id" field.

func (*ReadArticleUpsertOne) Update

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

func (*ReadArticleUpsertOne) UpdateArticleID

func (u *ReadArticleUpsertOne) UpdateArticleID() *ReadArticleUpsertOne

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

func (*ReadArticleUpsertOne) UpdateNewValues

func (u *ReadArticleUpsertOne) UpdateNewValues() *ReadArticleUpsertOne

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.ReadArticle.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(readarticle.FieldID)
		}),
	).
	Exec(ctx)

func (*ReadArticleUpsertOne) UpdateReadAt

func (u *ReadArticleUpsertOne) UpdateReadAt() *ReadArticleUpsertOne

UpdateReadAt sets the "read_at" field to the value that was provided on create.

func (*ReadArticleUpsertOne) UpdateUserID

func (u *ReadArticleUpsertOne) UpdateUserID() *ReadArticleUpsertOne

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

type ReadArticles

type ReadArticles []*ReadArticle

ReadArticles is a parsable slice of ReadArticle.

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
	// ReadArticle is the client for interacting with the ReadArticle builders.
	ReadArticle *ReadArticleClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// LastLoggedInAt holds the value of the "last_logged_in_at" field.
	LastLoggedInAt time.Time `json:"last_logged_in_at,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"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*User) Update

func (u *User) Update() *UserUpdateOne

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

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a 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) 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) 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) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

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

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) OnConflict

func (uc *UserCreate) OnConflict(opts ...sql.ConflictOption) *UserUpsertOne

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

client.User.Create().
	SetLastLoggedInAt(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) {
		SetLastLoggedInAt(v+v).
	}).
	Exec(ctx)

func (*UserCreate) OnConflictColumns

func (uc *UserCreate) OnConflictColumns(columns ...string) *UserUpsertOne

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

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

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) 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) SetLastLoggedInAt

func (uc *UserCreate) SetLastLoggedInAt(t time.Time) *UserCreate

SetLastLoggedInAt sets the "last_logged_in_at" 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) SetNillableLastLoggedInAt

func (uc *UserCreate) SetNillableLastLoggedInAt(t *time.Time) *UserCreate

SetNillableLastLoggedInAt sets the "last_logged_in_at" 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) 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) {
		SetLastLoggedInAt(v+v).
	}).
	Exec(ctx)

func (*UserCreateBulk) OnConflictColumns

func (ucb *UserCreateBulk) OnConflictColumns(columns ...string) *UserUpsertBulk

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

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

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

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

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

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

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

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

func (*UserDeleteOne) Where

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

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) 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) 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) 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) LastLoggedInAt

func (m *UserMutation) LastLoggedInAt() (r time.Time, exists bool)

LastLoggedInAt returns the value of the "last_logged_in_at" field in 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) OldLastLoggedInAt

func (m *UserMutation) OldLastLoggedInAt(ctx context.Context) (v time.Time, err error)

OldLastLoggedInAt returns the old "last_logged_in_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) 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) 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) 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) ResetLastLoggedInAt

func (m *UserMutation) ResetLastLoggedInAt()

ResetLastLoggedInAt resets all changes to the "last_logged_in_at" field.

func (*UserMutation) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

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) SetLastLoggedInAt

func (m *UserMutation) SetLastLoggedInAt(t time.Time)

SetLastLoggedInAt sets the "last_logged_in_at" field.

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) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP

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

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

type UserQuery

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

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

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

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

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

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

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

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

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

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

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

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id 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) 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 {
	LastLoggedInAt time.Time `json:"last_logged_in_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldLastLoggedInAt).
	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 ...OrderFunc) *UserQuery

Order specifies how the records should be ordered.

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

client.User.Query().
	Select(user.FieldLastLoggedInAt).
	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.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

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

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

func (*UserSelect) BoolX

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

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

func (*UserSelect) Bools

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

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

func (*UserSelect) BoolsX

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

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

func (*UserSelect) Float64

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

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

func (*UserSelect) Float64X

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

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

func (*UserSelect) Float64s

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

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

func (*UserSelect) Float64sX

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

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

func (*UserSelect) Int

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

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

func (*UserSelect) IntX

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

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

func (*UserSelect) Ints

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

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

func (*UserSelect) IntsX

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

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

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v any) error

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

func (*UserSelect) ScanX

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

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

func (*UserSelect) String

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

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

func (*UserSelect) StringX

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

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

func (*UserSelect) Strings

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

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

func (*UserSelect) StringsX

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

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

type UserUpdate

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

UserUpdate is the builder for updating User entities.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

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

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) 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) SetLastLoggedInAt

func (uu *UserUpdate) SetLastLoggedInAt(t time.Time) *UserUpdate

SetLastLoggedInAt sets the "last_logged_in_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) SetNillableLastLoggedInAt

func (uu *UserUpdate) SetNillableLastLoggedInAt(t *time.Time) *UserUpdate

SetNillableLastLoggedInAt sets the "last_logged_in_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) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

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

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) 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) SetLastLoggedInAt

func (uuo *UserUpdateOne) SetLastLoggedInAt(t time.Time) *UserUpdateOne

SetLastLoggedInAt sets the "last_logged_in_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) SetNillableLastLoggedInAt

func (uuo *UserUpdateOne) SetNillableLastLoggedInAt(t *time.Time) *UserUpdateOne

SetNillableLastLoggedInAt sets the "last_logged_in_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) SetLastLoggedInAt

func (u *UserUpsert) SetLastLoggedInAt(v time.Time) *UserUpsert

SetLastLoggedInAt sets the "last_logged_in_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) UpdateLastLoggedInAt

func (u *UserUpsert) UpdateLastLoggedInAt() *UserUpsert

UpdateLastLoggedInAt sets the "last_logged_in_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) SetLastLoggedInAt

func (u *UserUpsertBulk) SetLastLoggedInAt(v time.Time) *UserUpsertBulk

SetLastLoggedInAt sets the "last_logged_in_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) UpdateLastLoggedInAt

func (u *UserUpsertBulk) UpdateLastLoggedInAt() *UserUpsertBulk

UpdateLastLoggedInAt sets the "last_logged_in_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) SetLastLoggedInAt

func (u *UserUpsertOne) SetLastLoggedInAt(v time.Time) *UserUpsertOne

SetLastLoggedInAt sets the "last_logged_in_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) UpdateLastLoggedInAt

func (u *UserUpsertOne) UpdateLastLoggedInAt() *UserUpsertOne

UpdateLastLoggedInAt sets the "last_logged_in_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