ent

package
v0.0.0-...-da8fa4f Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 31 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.
	TypeLike  = "Like"
	TypeTweet = "Tweet"
	TypeUser  = "User"
)

Variables

View Source
var (
	// UserOrderFieldAge orders User by age.
	UserOrderFieldAge = &UserOrderField{
		Value: func(u *User) (ent.Value, error) {
			return u.Age, nil
		},
		column: user.FieldAge,
		toTerm: user.ByAge,
		toCursor: func(u *User) Cursor {
			return Cursor{
				ID:    u.ID,
				Value: u.Age,
			}
		},
	}
	// UserOrderFieldName orders User by name.
	UserOrderFieldName = &UserOrderField{
		Value: func(u *User) (ent.Value, error) {
			return u.Name, nil
		},
		column: user.FieldName,
		toTerm: user.ByName,
		toCursor: func(u *User) Cursor {
			return Cursor{
				ID:    u.ID,
				Value: u.Name,
			}
		},
	}
)
View Source
var DefaultTweetOrder = &TweetOrder{
	Direction: entgql.OrderDirectionAsc,
	Field: &TweetOrderField{
		Value: func(t *Tweet) (ent.Value, error) {
			return t.ID, nil
		},
		column: tweet.FieldID,
		toTerm: tweet.ByID,
		toCursor: func(t *Tweet) Cursor {
			return Cursor{ID: t.ID}
		},
	},
}

DefaultTweetOrder is the default ordering of Tweet.

View Source
var DefaultUserOrder = &UserOrder{
	Direction: entgql.OrderDirectionAsc,
	Field: &UserOrderField{
		Value: func(u *User) (ent.Value, error) {
			return u.ID, nil
		},
		column: user.FieldID,
		toTerm: user.ByID,
		toCursor: func(u *User) Cursor {
			return Cursor{ID: u.ID}
		},
	},
}

DefaultUserOrder is the default ordering of User.

View Source
var ErrEmptyTweetWhereInput = errors.New("ent: empty predicate TweetWhereInput")

ErrEmptyTweetWhereInput is returned in case the TweetWhereInput is empty.

View Source
var ErrEmptyUserWhereInput = errors.New("ent: empty predicate UserWhereInput")

ErrEmptyUserWhereInput is returned in case the UserWhereInput is empty.

View Source
var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction")

ErrTxStarted is returned when trying to start a new transaction from a transactional client.

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

func OpenTxFromContext

func OpenTxFromContext(ctx context.Context) (context.Context, driver.Tx, error)

OpenTxFromContext open transactions from client stored in context.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Like is the client for interacting with the Like builders.
	Like *LikeClient
	// Tweet is the client for interacting with the Tweet builders.
	Tweet *TweetClient
	// 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().
	Like.
	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) Noder

func (c *Client) Noder(ctx context.Context, id int, opts ...NodeOption) (_ Noder, err error)

Noder returns a Node by its id. If the NodeType was not provided, it will be derived from the id value according to the universal-id configuration.

c.Noder(ctx, id)
c.Noder(ctx, id, ent.WithNodeType(typeResolver))

func (*Client) Noders

func (c *Client) Noders(ctx context.Context, ids []int, opts ...NodeOption) ([]Noder, error)

func (*Client) OpenTx

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

OpenTx opens a transaction and returns a transactional context along with the created transaction.

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 CreateLikeInput

type CreateLikeInput struct {
	CreateTime *time.Time
	UpdateTime *time.Time
	LikedAt    *time.Time
	UserID     int
	TweetID    int
}

CreateLikeInput represents a mutation input for creating likes.

func (*CreateLikeInput) Mutate

func (i *CreateLikeInput) Mutate(m *LikeMutation)

Mutate applies the CreateLikeInput on the LikeMutation builder.

type Cursor

type Cursor = entgql.Cursor[int]

Common entgql types.

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 Like

type Like struct {

	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// test
	LikedAt time.Time `json:"liked_at,omitempty"`
	// test
	UserID int `json:"user_id,omitempty"`
	// test
	TweetID int `json:"tweet_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the LikeQuery when eager-loading is set.
	Edges LikeEdges `json:"edges"`
	// contains filtered or unexported fields
}

Like is the model entity for the Like schema.

func (*Like) QueryTweet

func (l *Like) QueryTweet() *TweetQuery

QueryTweet queries the "tweet" edge of the Like entity.

func (*Like) QueryUser

func (l *Like) QueryUser() *UserQuery

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

func (*Like) String

func (l *Like) String() string

String implements the fmt.Stringer.

func (*Like) Unwrap

func (l *Like) Unwrap() *Like

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

func (l *Like) Update() *LikeUpdateOne

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

func (*Like) Value

func (l *Like) Value(name string) (ent.Value, error)

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

type LikeClient

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

LikeClient is a client for the Like schema.

func NewLikeClient

func NewLikeClient(c config) *LikeClient

NewLikeClient returns a client for the Like from the given config.

func (*LikeClient) Create

func (c *LikeClient) Create() *LikeCreate

Create returns a builder for creating a Like entity.

func (*LikeClient) CreateBulk

func (c *LikeClient) CreateBulk(builders ...*LikeCreate) *LikeCreateBulk

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

func (*LikeClient) Delete

func (c *LikeClient) Delete() *LikeDelete

Delete returns a delete builder for Like.

func (*LikeClient) Hooks

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

Hooks returns the client hooks.

func (*LikeClient) Intercept

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

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

func (*LikeClient) Interceptors

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

Interceptors returns the client interceptors.

func (*LikeClient) MapCreateBulk

func (c *LikeClient) MapCreateBulk(slice any, setFunc func(*LikeCreate, int)) *LikeCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*LikeClient) Query

func (c *LikeClient) Query() *LikeQuery

Query returns a query builder for Like.

func (*LikeClient) QueryTweet

func (c *LikeClient) QueryTweet(l *Like) *TweetQuery

QueryTweet queries the tweet edge of a Like.

func (*LikeClient) QueryUser

func (c *LikeClient) QueryUser(l *Like) *UserQuery

QueryUser queries the user edge of a Like.

func (*LikeClient) Update

func (c *LikeClient) Update() *LikeUpdate

Update returns an update builder for Like.

func (*LikeClient) UpdateOne

func (c *LikeClient) UpdateOne(l *Like) *LikeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*LikeClient) Use

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

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

type LikeCreate

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

LikeCreate is the builder for creating a Like entity.

func (*LikeCreate) Exec

func (lc *LikeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*LikeCreate) ExecX

func (lc *LikeCreate) ExecX(ctx context.Context)

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

func (*LikeCreate) Mutation

func (lc *LikeCreate) Mutation() *LikeMutation

Mutation returns the LikeMutation object of the builder.

func (*LikeCreate) OnConflict

func (lc *LikeCreate) OnConflict(opts ...sql.ConflictOption) *LikeUpsertOne

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

client.Like.Create().
	SetCreateTime(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.LikeUpsert) {
		SetCreateTime(v+v).
	}).
	Exec(ctx)

func (*LikeCreate) OnConflictColumns

func (lc *LikeCreate) OnConflictColumns(columns ...string) *LikeUpsertOne

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

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

func (*LikeCreate) Save

func (lc *LikeCreate) Save(ctx context.Context) (*Like, error)

Save creates the Like in the database.

func (*LikeCreate) SaveX

func (lc *LikeCreate) SaveX(ctx context.Context) *Like

SaveX calls Save and panics if Save returns an error.

func (*LikeCreate) SetCreateTime

func (lc *LikeCreate) SetCreateTime(t time.Time) *LikeCreate

SetCreateTime sets the "create_time" field.

func (*LikeCreate) SetInput

func (c *LikeCreate) SetInput(i CreateLikeInput) *LikeCreate

SetInput applies the change-set in the CreateLikeInput on the LikeCreate builder.

func (*LikeCreate) SetLikedAt

func (lc *LikeCreate) SetLikedAt(t time.Time) *LikeCreate

SetLikedAt sets the "liked_at" field.

func (*LikeCreate) SetNillableCreateTime

func (lc *LikeCreate) SetNillableCreateTime(t *time.Time) *LikeCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*LikeCreate) SetNillableLikedAt

func (lc *LikeCreate) SetNillableLikedAt(t *time.Time) *LikeCreate

SetNillableLikedAt sets the "liked_at" field if the given value is not nil.

func (*LikeCreate) SetNillableUpdateTime

func (lc *LikeCreate) SetNillableUpdateTime(t *time.Time) *LikeCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*LikeCreate) SetTweet

func (lc *LikeCreate) SetTweet(t *Tweet) *LikeCreate

SetTweet sets the "tweet" edge to the Tweet entity.

func (*LikeCreate) SetTweetID

func (lc *LikeCreate) SetTweetID(i int) *LikeCreate

SetTweetID sets the "tweet_id" field.

func (*LikeCreate) SetUpdateTime

func (lc *LikeCreate) SetUpdateTime(t time.Time) *LikeCreate

SetUpdateTime sets the "update_time" field.

func (*LikeCreate) SetUser

func (lc *LikeCreate) SetUser(u *User) *LikeCreate

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

func (*LikeCreate) SetUserID

func (lc *LikeCreate) SetUserID(i int) *LikeCreate

SetUserID sets the "user_id" field.

type LikeCreateBulk

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

LikeCreateBulk is the builder for creating many Like entities in bulk.

func (*LikeCreateBulk) Exec

func (lcb *LikeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*LikeCreateBulk) ExecX

func (lcb *LikeCreateBulk) ExecX(ctx context.Context)

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

func (*LikeCreateBulk) OnConflict

func (lcb *LikeCreateBulk) OnConflict(opts ...sql.ConflictOption) *LikeUpsertBulk

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

client.Like.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.LikeUpsert) {
		SetCreateTime(v+v).
	}).
	Exec(ctx)

func (*LikeCreateBulk) OnConflictColumns

func (lcb *LikeCreateBulk) OnConflictColumns(columns ...string) *LikeUpsertBulk

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

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

func (*LikeCreateBulk) Save

func (lcb *LikeCreateBulk) Save(ctx context.Context) ([]*Like, error)

Save creates the Like entities in the database.

func (*LikeCreateBulk) SaveX

func (lcb *LikeCreateBulk) SaveX(ctx context.Context) []*Like

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

type LikeDelete

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

LikeDelete is the builder for deleting a Like entity.

func (*LikeDelete) Exec

func (ld *LikeDelete) Exec(ctx context.Context) (int, error)

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

func (*LikeDelete) ExecX

func (ld *LikeDelete) ExecX(ctx context.Context) int

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

func (*LikeDelete) Where

func (ld *LikeDelete) Where(ps ...predicate.Like) *LikeDelete

Where appends a list predicates to the LikeDelete builder.

type LikeDeleteOne

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

LikeDeleteOne is the builder for deleting a single Like entity.

func (*LikeDeleteOne) Exec

func (ldo *LikeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*LikeDeleteOne) ExecX

func (ldo *LikeDeleteOne) ExecX(ctx context.Context)

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

func (*LikeDeleteOne) Where

func (ldo *LikeDeleteOne) Where(ps ...predicate.Like) *LikeDeleteOne

Where appends a list predicates to the LikeDelete builder.

type LikeEdges

type LikeEdges struct {
	// test
	User *User `json:"user,omitempty"`
	// test
	Tweet *Tweet `json:"tweet,omitempty"`
	// contains filtered or unexported fields
}

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

func (LikeEdges) TweetOrErr

func (e LikeEdges) TweetOrErr() (*Tweet, error)

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

func (LikeEdges) UserOrErr

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

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

type LikeFilter

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

LikeFilter provides a generic filtering capability at runtime for LikeQuery.

func (*LikeFilter) Where

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

Where applies the entql predicate on the query filter.

func (*LikeFilter) WhereCreateTime

func (f *LikeFilter) WhereCreateTime(p entql.TimeP)

WhereCreateTime applies the entql time.Time predicate on the create_time field.

func (*LikeFilter) WhereHasTweet

func (f *LikeFilter) WhereHasTweet()

WhereHasTweet applies a predicate to check if query has an edge tweet.

func (*LikeFilter) WhereHasTweetWith

func (f *LikeFilter) WhereHasTweetWith(preds ...predicate.Tweet)

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

func (*LikeFilter) WhereHasUser

func (f *LikeFilter) WhereHasUser()

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

func (*LikeFilter) WhereHasUserWith

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

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

func (*LikeFilter) WhereLikedAt

func (f *LikeFilter) WhereLikedAt(p entql.TimeP)

WhereLikedAt applies the entql time.Time predicate on the liked_at field.

func (*LikeFilter) WhereTweetID

func (f *LikeFilter) WhereTweetID(p entql.IntP)

WhereTweetID applies the entql int predicate on the tweet_id field.

func (*LikeFilter) WhereUpdateTime

func (f *LikeFilter) WhereUpdateTime(p entql.TimeP)

WhereUpdateTime applies the entql time.Time predicate on the update_time field.

func (*LikeFilter) WhereUserID

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

WhereUserID applies the entql int predicate on the user_id field.

type LikeGroupBy

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

LikeGroupBy is the group-by builder for Like entities.

func (*LikeGroupBy) Aggregate

func (lgb *LikeGroupBy) Aggregate(fns ...AggregateFunc) *LikeGroupBy

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

func (*LikeGroupBy) Bool

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

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

func (*LikeGroupBy) BoolX

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

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

func (*LikeGroupBy) Bools

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

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

func (*LikeGroupBy) BoolsX

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

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

func (*LikeGroupBy) Float64

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

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

func (*LikeGroupBy) Float64X

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

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

func (*LikeGroupBy) Float64s

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

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

func (*LikeGroupBy) Float64sX

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

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

func (*LikeGroupBy) Int

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

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

func (*LikeGroupBy) IntX

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

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

func (*LikeGroupBy) Ints

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

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

func (*LikeGroupBy) IntsX

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

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

func (*LikeGroupBy) Scan

func (lgb *LikeGroupBy) Scan(ctx context.Context, v any) error

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

func (*LikeGroupBy) ScanX

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

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

func (*LikeGroupBy) String

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

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

func (*LikeGroupBy) StringX

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

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

func (*LikeGroupBy) Strings

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

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

func (*LikeGroupBy) StringsX

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

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

type LikeMutation

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

LikeMutation represents an operation that mutates the Like nodes in the graph.

func (*LikeMutation) AddField

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

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

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

func (*LikeMutation) AddedField

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

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

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

func (*LikeMutation) AddedIDs

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

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

func (*LikeMutation) ClearEdge

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

func (m *LikeMutation) 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 (*LikeMutation) ClearTweet

func (m *LikeMutation) ClearTweet()

ClearTweet clears the "tweet" edge to the Tweet entity.

func (*LikeMutation) ClearUser

func (m *LikeMutation) ClearUser()

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

func (*LikeMutation) ClearedEdges

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

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

func (*LikeMutation) ClearedFields

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

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

func (LikeMutation) Client

func (m LikeMutation) 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 (*LikeMutation) CreateTime

func (m *LikeMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*LikeMutation) EdgeCleared

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

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

func (*LikeMutation) Field

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

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

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

func (*LikeMutation) Fields

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

func (m *LikeMutation) Filter() *LikeFilter

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

func (*LikeMutation) LikedAt

func (m *LikeMutation) LikedAt() (r time.Time, exists bool)

LikedAt returns the value of the "liked_at" field in the mutation.

func (*LikeMutation) OldField

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

func (m *LikeMutation) Op() Op

Op returns the operation name.

func (*LikeMutation) RemovedEdges

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

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

func (*LikeMutation) RemovedIDs

func (m *LikeMutation) 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 (*LikeMutation) ResetCreateTime

func (m *LikeMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*LikeMutation) ResetEdge

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

func (m *LikeMutation) 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 (*LikeMutation) ResetLikedAt

func (m *LikeMutation) ResetLikedAt()

ResetLikedAt resets all changes to the "liked_at" field.

func (*LikeMutation) ResetTweet

func (m *LikeMutation) ResetTweet()

ResetTweet resets all changes to the "tweet" edge.

func (*LikeMutation) ResetTweetID

func (m *LikeMutation) ResetTweetID()

ResetTweetID resets all changes to the "tweet_id" field.

func (*LikeMutation) ResetUpdateTime

func (m *LikeMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*LikeMutation) ResetUser

func (m *LikeMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*LikeMutation) ResetUserID

func (m *LikeMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*LikeMutation) SetCreateTime

func (m *LikeMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*LikeMutation) SetField

func (m *LikeMutation) 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 (*LikeMutation) SetLikedAt

func (m *LikeMutation) SetLikedAt(t time.Time)

SetLikedAt sets the "liked_at" field.

func (*LikeMutation) SetOp

func (m *LikeMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*LikeMutation) SetTweetID

func (m *LikeMutation) SetTweetID(i int)

SetTweetID sets the "tweet_id" field.

func (*LikeMutation) SetUpdateTime

func (m *LikeMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (*LikeMutation) SetUserID

func (m *LikeMutation) SetUserID(i int)

SetUserID sets the "user_id" field.

func (*LikeMutation) TweetCleared

func (m *LikeMutation) TweetCleared() bool

TweetCleared reports if the "tweet" edge to the Tweet entity was cleared.

func (*LikeMutation) TweetID

func (m *LikeMutation) TweetID() (r int, exists bool)

TweetID returns the value of the "tweet_id" field in the mutation.

func (*LikeMutation) TweetIDs

func (m *LikeMutation) TweetIDs() (ids []int)

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

func (LikeMutation) Tx

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

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

func (*LikeMutation) Type

func (m *LikeMutation) Type() string

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

func (*LikeMutation) UpdateTime

func (m *LikeMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*LikeMutation) UserCleared

func (m *LikeMutation) UserCleared() bool

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

func (*LikeMutation) UserID

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

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

func (*LikeMutation) UserIDs

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

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

func (*LikeMutation) Where

func (m *LikeMutation) Where(ps ...predicate.Like)

Where appends a list predicates to the LikeMutation builder.

func (*LikeMutation) WhereP

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

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

type LikeQuery

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

LikeQuery is the builder for querying Like entities.

func (*LikeQuery) Aggregate

func (lq *LikeQuery) Aggregate(fns ...AggregateFunc) *LikeSelect

Aggregate returns a LikeSelect configured with the given aggregations.

func (*LikeQuery) All

func (lq *LikeQuery) All(ctx context.Context) ([]*Like, error)

All executes the query and returns a list of Likes.

func (*LikeQuery) AllX

func (lq *LikeQuery) AllX(ctx context.Context) []*Like

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

func (*LikeQuery) Clone

func (lq *LikeQuery) Clone() *LikeQuery

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

func (*LikeQuery) Count

func (lq *LikeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*LikeQuery) CountX

func (lq *LikeQuery) CountX(ctx context.Context) int

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

func (*LikeQuery) Exist

func (lq *LikeQuery) Exist(ctx context.Context) (bool, error)

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

func (*LikeQuery) ExistX

func (lq *LikeQuery) ExistX(ctx context.Context) bool

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

func (*LikeQuery) Filter

func (lq *LikeQuery) Filter() *LikeFilter

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

func (*LikeQuery) First

func (lq *LikeQuery) First(ctx context.Context) (*Like, error)

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

func (*LikeQuery) FirstX

func (lq *LikeQuery) FirstX(ctx context.Context) *Like

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

func (*LikeQuery) GroupBy

func (lq *LikeQuery) GroupBy(field string, fields ...string) *LikeGroupBy

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

client.Like.Query().
	GroupBy(like.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*LikeQuery) Limit

func (lq *LikeQuery) Limit(limit int) *LikeQuery

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

func (*LikeQuery) Offset

func (lq *LikeQuery) Offset(offset int) *LikeQuery

Offset to start from.

func (*LikeQuery) Only

func (lq *LikeQuery) Only(ctx context.Context) (*Like, error)

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

func (*LikeQuery) OnlyX

func (lq *LikeQuery) OnlyX(ctx context.Context) *Like

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

func (*LikeQuery) Order

func (lq *LikeQuery) Order(o ...like.OrderOption) *LikeQuery

Order specifies how the records should be ordered.

func (*LikeQuery) QueryTweet

func (lq *LikeQuery) QueryTweet() *TweetQuery

QueryTweet chains the current query on the "tweet" edge.

func (*LikeQuery) QueryUser

func (lq *LikeQuery) QueryUser() *UserQuery

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

func (*LikeQuery) Select

func (lq *LikeQuery) Select(fields ...string) *LikeSelect

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

client.Like.Query().
	Select(like.FieldCreateTime).
	Scan(ctx, &v)

func (*LikeQuery) Unique

func (lq *LikeQuery) Unique(unique bool) *LikeQuery

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

func (lq *LikeQuery) Where(ps ...predicate.Like) *LikeQuery

Where adds a new predicate for the LikeQuery builder.

func (*LikeQuery) WithTweet

func (lq *LikeQuery) WithTweet(opts ...func(*TweetQuery)) *LikeQuery

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

func (*LikeQuery) WithUser

func (lq *LikeQuery) WithUser(opts ...func(*UserQuery)) *LikeQuery

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

type LikeSelect

type LikeSelect struct {
	*LikeQuery
	// contains filtered or unexported fields
}

LikeSelect is the builder for selecting fields of Like entities.

func (*LikeSelect) Aggregate

func (ls *LikeSelect) Aggregate(fns ...AggregateFunc) *LikeSelect

Aggregate adds the given aggregation functions to the selector query.

func (*LikeSelect) Bool

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

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

func (*LikeSelect) BoolX

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

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

func (*LikeSelect) Bools

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

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

func (*LikeSelect) BoolsX

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

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

func (*LikeSelect) Float64

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

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

func (*LikeSelect) Float64X

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

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

func (*LikeSelect) Float64s

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

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

func (*LikeSelect) Float64sX

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

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

func (*LikeSelect) Int

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

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

func (*LikeSelect) IntX

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

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

func (*LikeSelect) Ints

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

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

func (*LikeSelect) IntsX

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

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

func (*LikeSelect) Scan

func (ls *LikeSelect) Scan(ctx context.Context, v any) error

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

func (*LikeSelect) ScanX

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

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

func (*LikeSelect) String

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

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

func (*LikeSelect) StringX

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

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

func (*LikeSelect) Strings

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

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

func (*LikeSelect) StringsX

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

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

type LikeUpdate

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

LikeUpdate is the builder for updating Like entities.

func (*LikeUpdate) Exec

func (lu *LikeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*LikeUpdate) ExecX

func (lu *LikeUpdate) ExecX(ctx context.Context)

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

func (*LikeUpdate) Mutation

func (lu *LikeUpdate) Mutation() *LikeMutation

Mutation returns the LikeMutation object of the builder.

func (*LikeUpdate) Save

func (lu *LikeUpdate) Save(ctx context.Context) (int, error)

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

func (*LikeUpdate) SaveX

func (lu *LikeUpdate) SaveX(ctx context.Context) int

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

func (*LikeUpdate) SetUpdateTime

func (lu *LikeUpdate) SetUpdateTime(t time.Time) *LikeUpdate

SetUpdateTime sets the "update_time" field.

func (*LikeUpdate) Where

func (lu *LikeUpdate) Where(ps ...predicate.Like) *LikeUpdate

Where appends a list predicates to the LikeUpdate builder.

type LikeUpdateOne

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

LikeUpdateOne is the builder for updating a single Like entity.

func (*LikeUpdateOne) Exec

func (luo *LikeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*LikeUpdateOne) ExecX

func (luo *LikeUpdateOne) ExecX(ctx context.Context)

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

func (*LikeUpdateOne) Mutation

func (luo *LikeUpdateOne) Mutation() *LikeMutation

Mutation returns the LikeMutation object of the builder.

func (*LikeUpdateOne) Save

func (luo *LikeUpdateOne) Save(ctx context.Context) (*Like, error)

Save executes the query and returns the updated Like entity.

func (*LikeUpdateOne) SaveX

func (luo *LikeUpdateOne) SaveX(ctx context.Context) *Like

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

func (*LikeUpdateOne) Select

func (luo *LikeUpdateOne) Select(field string, fields ...string) *LikeUpdateOne

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

func (*LikeUpdateOne) SetUpdateTime

func (luo *LikeUpdateOne) SetUpdateTime(t time.Time) *LikeUpdateOne

SetUpdateTime sets the "update_time" field.

func (*LikeUpdateOne) Where

func (luo *LikeUpdateOne) Where(ps ...predicate.Like) *LikeUpdateOne

Where appends a list predicates to the LikeUpdate builder.

type LikeUpsert

type LikeUpsert struct {
	*sql.UpdateSet
}

LikeUpsert is the "OnConflict" setter.

func (*LikeUpsert) SetUpdateTime

func (u *LikeUpsert) SetUpdateTime(v time.Time) *LikeUpsert

SetUpdateTime sets the "update_time" field.

func (*LikeUpsert) UpdateUpdateTime

func (u *LikeUpsert) UpdateUpdateTime() *LikeUpsert

UpdateUpdateTime sets the "update_time" field to the value that was provided on create.

type LikeUpsertBulk

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

LikeUpsertBulk is the builder for "upsert"-ing a bulk of Like nodes.

func (*LikeUpsertBulk) DoNothing

func (u *LikeUpsertBulk) DoNothing() *LikeUpsertBulk

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

func (*LikeUpsertBulk) Exec

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

Exec executes the query.

func (*LikeUpsertBulk) ExecX

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

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

func (*LikeUpsertBulk) Ignore

func (u *LikeUpsertBulk) Ignore() *LikeUpsertBulk

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

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

func (*LikeUpsertBulk) SetUpdateTime

func (u *LikeUpsertBulk) SetUpdateTime(v time.Time) *LikeUpsertBulk

SetUpdateTime sets the "update_time" field.

func (*LikeUpsertBulk) Update

func (u *LikeUpsertBulk) Update(set func(*LikeUpsert)) *LikeUpsertBulk

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

func (*LikeUpsertBulk) UpdateNewValues

func (u *LikeUpsertBulk) UpdateNewValues() *LikeUpsertBulk

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

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

func (*LikeUpsertBulk) UpdateUpdateTime

func (u *LikeUpsertBulk) UpdateUpdateTime() *LikeUpsertBulk

UpdateUpdateTime sets the "update_time" field to the value that was provided on create.

type LikeUpsertOne

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

LikeUpsertOne is the builder for "upsert"-ing

one Like node.

func (*LikeUpsertOne) DoNothing

func (u *LikeUpsertOne) DoNothing() *LikeUpsertOne

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

func (*LikeUpsertOne) Exec

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

Exec executes the query.

func (*LikeUpsertOne) ExecX

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

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

func (*LikeUpsertOne) Ignore

func (u *LikeUpsertOne) Ignore() *LikeUpsertOne

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

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

func (*LikeUpsertOne) SetUpdateTime

func (u *LikeUpsertOne) SetUpdateTime(v time.Time) *LikeUpsertOne

SetUpdateTime sets the "update_time" field.

func (*LikeUpsertOne) Update

func (u *LikeUpsertOne) Update(set func(*LikeUpsert)) *LikeUpsertOne

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

func (*LikeUpsertOne) UpdateNewValues

func (u *LikeUpsertOne) UpdateNewValues() *LikeUpsertOne

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

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

func (*LikeUpsertOne) UpdateUpdateTime

func (u *LikeUpsertOne) UpdateUpdateTime() *LikeUpsertOne

UpdateUpdateTime sets the "update_time" field to the value that was provided on create.

type Likes

type Likes []*Like

Likes is a parsable slice of Like.

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 NodeOption

type NodeOption func(*nodeOptions)

NodeOption allows configuring the Noder execution using functional options.

func WithFixedNodeType

func WithFixedNodeType(t string) NodeOption

WithFixedNodeType sets the Type of the node to a fixed value.

func WithNodeType

func WithNodeType(f func(context.Context, int) (string, error)) NodeOption

WithNodeType sets the node Type resolver function (i.e. the table to query). If was not provided, the table will be derived from the universal-id configuration as described in: https://entgo.io/docs/migrate/#universal-ids.

type Noder

type Noder interface {
	IsNode()
}

Noder wraps the basic Node method.

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 OrderDirection

type OrderDirection = entgql.OrderDirection

Common entgql types.

type OrderFunc

type OrderFunc func(*sql.Selector)

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

type PageInfo

type PageInfo = entgql.PageInfo[int]

Common entgql types.

type Policy

type Policy = ent.Policy

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

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tweet

type Tweet struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Text holds the value of the "text" field.
	Text string `json:"text,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the TweetQuery when eager-loading is set.
	Edges TweetEdges `json:"edges"`
	// contains filtered or unexported fields
}

Tweet is the model entity for the Tweet schema.

func (*Tweet) IsNode

func (n *Tweet) IsNode()

IsNode implements the Node interface check for GQLGen.

func (*Tweet) LikedUsers

func (t *Tweet) LikedUsers(ctx context.Context) (result []*User, err error)

func (*Tweet) NamedLikedUsers

func (t *Tweet) NamedLikedUsers(name string) ([]*User, error)

NamedLikedUsers returns the LikedUsers named value or an error if the edge was not loaded in eager-loading with this name.

func (*Tweet) NamedLikes

func (t *Tweet) NamedLikes(name string) ([]*Like, error)

NamedLikes returns the Likes named value or an error if the edge was not loaded in eager-loading with this name.

func (*Tweet) QueryLikedUsers

func (t *Tweet) QueryLikedUsers() *UserQuery

QueryLikedUsers queries the "liked_users" edge of the Tweet entity.

func (*Tweet) QueryLikes

func (t *Tweet) QueryLikes() *LikeQuery

QueryLikes queries the "likes" edge of the Tweet entity.

func (*Tweet) String

func (t *Tweet) String() string

String implements the fmt.Stringer.

func (*Tweet) ToEdge

func (t *Tweet) ToEdge(order *TweetOrder) *TweetEdge

ToEdge converts Tweet into TweetEdge.

func (*Tweet) Unwrap

func (t *Tweet) Unwrap() *Tweet

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

func (t *Tweet) Update() *TweetUpdateOne

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

func (*Tweet) Value

func (t *Tweet) Value(name string) (ent.Value, error)

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

type TweetClient

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

TweetClient is a client for the Tweet schema.

func NewTweetClient

func NewTweetClient(c config) *TweetClient

NewTweetClient returns a client for the Tweet from the given config.

func (*TweetClient) Create

func (c *TweetClient) Create() *TweetCreate

Create returns a builder for creating a Tweet entity.

func (*TweetClient) CreateBulk

func (c *TweetClient) CreateBulk(builders ...*TweetCreate) *TweetCreateBulk

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

func (*TweetClient) Delete

func (c *TweetClient) Delete() *TweetDelete

Delete returns a delete builder for Tweet.

func (*TweetClient) DeleteOne

func (c *TweetClient) DeleteOne(t *Tweet) *TweetDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*TweetClient) DeleteOneID

func (c *TweetClient) DeleteOneID(id int) *TweetDeleteOne

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

func (*TweetClient) Get

func (c *TweetClient) Get(ctx context.Context, id int) (*Tweet, error)

Get returns a Tweet entity by its id.

func (*TweetClient) GetX

func (c *TweetClient) GetX(ctx context.Context, id int) *Tweet

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

func (*TweetClient) Hooks

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

Hooks returns the client hooks.

func (*TweetClient) Intercept

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

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

func (*TweetClient) Interceptors

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

Interceptors returns the client interceptors.

func (*TweetClient) MapCreateBulk

func (c *TweetClient) MapCreateBulk(slice any, setFunc func(*TweetCreate, int)) *TweetCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*TweetClient) Query

func (c *TweetClient) Query() *TweetQuery

Query returns a query builder for Tweet.

func (*TweetClient) QueryLikedUsers

func (c *TweetClient) QueryLikedUsers(t *Tweet) *UserQuery

QueryLikedUsers queries the liked_users edge of a Tweet.

func (*TweetClient) QueryLikes

func (c *TweetClient) QueryLikes(t *Tweet) *LikeQuery

QueryLikes queries the likes edge of a Tweet.

func (*TweetClient) Update

func (c *TweetClient) Update() *TweetUpdate

Update returns an update builder for Tweet.

func (*TweetClient) UpdateOne

func (c *TweetClient) UpdateOne(t *Tweet) *TweetUpdateOne

UpdateOne returns an update builder for the given entity.

func (*TweetClient) UpdateOneID

func (c *TweetClient) UpdateOneID(id int) *TweetUpdateOne

UpdateOneID returns an update builder for the given id.

func (*TweetClient) Use

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

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

type TweetConnection

type TweetConnection struct {
	Edges      []*TweetEdge `json:"edges"`
	PageInfo   PageInfo     `json:"pageInfo"`
	TotalCount int          `json:"totalCount"`
}

TweetConnection is the connection containing edges to Tweet.

type TweetCreate

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

TweetCreate is the builder for creating a Tweet entity.

func (*TweetCreate) AddLikedUserIDs

func (tc *TweetCreate) AddLikedUserIDs(ids ...int) *TweetCreate

AddLikedUserIDs adds the "liked_users" edge to the User entity by IDs.

func (*TweetCreate) AddLikedUsers

func (tc *TweetCreate) AddLikedUsers(u ...*User) *TweetCreate

AddLikedUsers adds the "liked_users" edges to the User entity.

func (*TweetCreate) Exec

func (tc *TweetCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*TweetCreate) ExecX

func (tc *TweetCreate) ExecX(ctx context.Context)

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

func (*TweetCreate) Mutation

func (tc *TweetCreate) Mutation() *TweetMutation

Mutation returns the TweetMutation object of the builder.

func (*TweetCreate) OnConflict

func (tc *TweetCreate) OnConflict(opts ...sql.ConflictOption) *TweetUpsertOne

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

client.Tweet.Create().
	SetText(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.TweetUpsert) {
		SetText(v+v).
	}).
	Exec(ctx)

func (*TweetCreate) OnConflictColumns

func (tc *TweetCreate) OnConflictColumns(columns ...string) *TweetUpsertOne

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

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

func (*TweetCreate) Save

func (tc *TweetCreate) Save(ctx context.Context) (*Tweet, error)

Save creates the Tweet in the database.

func (*TweetCreate) SaveX

func (tc *TweetCreate) SaveX(ctx context.Context) *Tweet

SaveX calls Save and panics if Save returns an error.

func (*TweetCreate) SetText

func (tc *TweetCreate) SetText(s string) *TweetCreate

SetText sets the "text" field.

type TweetCreateBulk

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

TweetCreateBulk is the builder for creating many Tweet entities in bulk.

func (*TweetCreateBulk) Exec

func (tcb *TweetCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*TweetCreateBulk) ExecX

func (tcb *TweetCreateBulk) ExecX(ctx context.Context)

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

func (*TweetCreateBulk) OnConflict

func (tcb *TweetCreateBulk) OnConflict(opts ...sql.ConflictOption) *TweetUpsertBulk

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

client.Tweet.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.TweetUpsert) {
		SetText(v+v).
	}).
	Exec(ctx)

func (*TweetCreateBulk) OnConflictColumns

func (tcb *TweetCreateBulk) OnConflictColumns(columns ...string) *TweetUpsertBulk

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

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

func (*TweetCreateBulk) Save

func (tcb *TweetCreateBulk) Save(ctx context.Context) ([]*Tweet, error)

Save creates the Tweet entities in the database.

func (*TweetCreateBulk) SaveX

func (tcb *TweetCreateBulk) SaveX(ctx context.Context) []*Tweet

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

type TweetDelete

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

TweetDelete is the builder for deleting a Tweet entity.

func (*TweetDelete) Exec

func (td *TweetDelete) Exec(ctx context.Context) (int, error)

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

func (*TweetDelete) ExecX

func (td *TweetDelete) ExecX(ctx context.Context) int

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

func (*TweetDelete) Where

func (td *TweetDelete) Where(ps ...predicate.Tweet) *TweetDelete

Where appends a list predicates to the TweetDelete builder.

type TweetDeleteOne

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

TweetDeleteOne is the builder for deleting a single Tweet entity.

func (*TweetDeleteOne) Exec

func (tdo *TweetDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*TweetDeleteOne) ExecX

func (tdo *TweetDeleteOne) ExecX(ctx context.Context)

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

func (*TweetDeleteOne) Where

func (tdo *TweetDeleteOne) Where(ps ...predicate.Tweet) *TweetDeleteOne

Where appends a list predicates to the TweetDelete builder.

type TweetEdge

type TweetEdge struct {
	Node   *Tweet `json:"node"`
	Cursor Cursor `json:"cursor"`
}

TweetEdge is the edge representation of Tweet.

type TweetEdges

type TweetEdges struct {
	// LikedUsers holds the value of the liked_users edge.
	LikedUsers []*User `json:"liked_users,omitempty"`
	// Likes holds the value of the likes edge.
	Likes []*Like `json:"likes,omitempty"`
	// contains filtered or unexported fields
}

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

func (TweetEdges) LikedUsersOrErr

func (e TweetEdges) LikedUsersOrErr() ([]*User, error)

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

func (TweetEdges) LikesOrErr

func (e TweetEdges) LikesOrErr() ([]*Like, error)

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

type TweetFilter

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

TweetFilter provides a generic filtering capability at runtime for TweetQuery.

func (*TweetFilter) Where

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

Where applies the entql predicate on the query filter.

func (*TweetFilter) WhereHasLikedUsers

func (f *TweetFilter) WhereHasLikedUsers()

WhereHasLikedUsers applies a predicate to check if query has an edge liked_users.

func (*TweetFilter) WhereHasLikedUsersWith

func (f *TweetFilter) WhereHasLikedUsersWith(preds ...predicate.User)

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

func (*TweetFilter) WhereHasLikes

func (f *TweetFilter) WhereHasLikes()

WhereHasLikes applies a predicate to check if query has an edge likes.

func (*TweetFilter) WhereHasLikesWith

func (f *TweetFilter) WhereHasLikesWith(preds ...predicate.Like)

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

func (*TweetFilter) WhereID

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

WhereID applies the entql int predicate on the id field.

func (*TweetFilter) WhereText

func (f *TweetFilter) WhereText(p entql.StringP)

WhereText applies the entql string predicate on the text field.

type TweetGroupBy

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

TweetGroupBy is the group-by builder for Tweet entities.

func (*TweetGroupBy) Aggregate

func (tgb *TweetGroupBy) Aggregate(fns ...AggregateFunc) *TweetGroupBy

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

func (*TweetGroupBy) Bool

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

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

func (*TweetGroupBy) BoolX

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

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

func (*TweetGroupBy) Bools

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

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

func (*TweetGroupBy) BoolsX

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

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

func (*TweetGroupBy) Float64

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

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

func (*TweetGroupBy) Float64X

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

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

func (*TweetGroupBy) Float64s

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

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

func (*TweetGroupBy) Float64sX

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

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

func (*TweetGroupBy) Int

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

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

func (*TweetGroupBy) IntX

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

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

func (*TweetGroupBy) Ints

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

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

func (*TweetGroupBy) IntsX

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

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

func (*TweetGroupBy) Scan

func (tgb *TweetGroupBy) Scan(ctx context.Context, v any) error

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

func (*TweetGroupBy) ScanX

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

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

func (*TweetGroupBy) String

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

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

func (*TweetGroupBy) StringX

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

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

func (*TweetGroupBy) Strings

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

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

func (*TweetGroupBy) StringsX

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

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

type TweetMutation

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

TweetMutation represents an operation that mutates the Tweet nodes in the graph.

func (*TweetMutation) AddField

func (m *TweetMutation) 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 (*TweetMutation) AddLikedUserIDs

func (m *TweetMutation) AddLikedUserIDs(ids ...int)

AddLikedUserIDs adds the "liked_users" edge to the User entity by ids.

func (*TweetMutation) AddedEdges

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

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

func (*TweetMutation) AddedField

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

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

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

func (*TweetMutation) AddedIDs

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

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

func (*TweetMutation) ClearEdge

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

func (m *TweetMutation) 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 (*TweetMutation) ClearLikedUsers

func (m *TweetMutation) ClearLikedUsers()

ClearLikedUsers clears the "liked_users" edge to the User entity.

func (*TweetMutation) ClearedEdges

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

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

func (*TweetMutation) ClearedFields

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

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

func (TweetMutation) Client

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

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

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

func (*TweetMutation) Field

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

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

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

func (*TweetMutation) Fields

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

func (m *TweetMutation) Filter() *TweetFilter

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

func (*TweetMutation) ID

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

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

func (*TweetMutation) IDs

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

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

func (*TweetMutation) LikedUsersCleared

func (m *TweetMutation) LikedUsersCleared() bool

LikedUsersCleared reports if the "liked_users" edge to the User entity was cleared.

func (*TweetMutation) LikedUsersIDs

func (m *TweetMutation) LikedUsersIDs() (ids []int)

LikedUsersIDs returns the "liked_users" edge IDs in the mutation.

func (*TweetMutation) OldField

func (m *TweetMutation) 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 (*TweetMutation) OldText

func (m *TweetMutation) OldText(ctx context.Context) (v string, err error)

OldText returns the old "text" field's value of the Tweet entity. If the Tweet 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 (*TweetMutation) Op

func (m *TweetMutation) Op() Op

Op returns the operation name.

func (*TweetMutation) RemoveLikedUserIDs

func (m *TweetMutation) RemoveLikedUserIDs(ids ...int)

RemoveLikedUserIDs removes the "liked_users" edge to the User entity by IDs.

func (*TweetMutation) RemovedEdges

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

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

func (*TweetMutation) RemovedIDs

func (m *TweetMutation) 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 (*TweetMutation) RemovedLikedUsersIDs

func (m *TweetMutation) RemovedLikedUsersIDs() (ids []int)

RemovedLikedUsers returns the removed IDs of the "liked_users" edge to the User entity.

func (*TweetMutation) ResetEdge

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

func (m *TweetMutation) 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 (*TweetMutation) ResetLikedUsers

func (m *TweetMutation) ResetLikedUsers()

ResetLikedUsers resets all changes to the "liked_users" edge.

func (*TweetMutation) ResetText

func (m *TweetMutation) ResetText()

ResetText resets all changes to the "text" field.

func (*TweetMutation) SetField

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

func (m *TweetMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*TweetMutation) SetText

func (m *TweetMutation) SetText(s string)

SetText sets the "text" field.

func (*TweetMutation) Text

func (m *TweetMutation) Text() (r string, exists bool)

Text returns the value of the "text" field in the mutation.

func (TweetMutation) Tx

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

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

func (*TweetMutation) Type

func (m *TweetMutation) Type() string

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

func (*TweetMutation) Where

func (m *TweetMutation) Where(ps ...predicate.Tweet)

Where appends a list predicates to the TweetMutation builder.

func (*TweetMutation) WhereP

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

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

type TweetOrder

type TweetOrder struct {
	Direction OrderDirection   `json:"direction"`
	Field     *TweetOrderField `json:"field"`
}

TweetOrder defines the ordering of Tweet.

type TweetOrderField

type TweetOrderField struct {
	// Value extracts the ordering value from the given Tweet.
	Value func(*Tweet) (ent.Value, error)
	// contains filtered or unexported fields
}

TweetOrderField defines the ordering field of Tweet.

type TweetPaginateOption

type TweetPaginateOption func(*tweetPager) error

TweetPaginateOption enables pagination customization.

func WithTweetFilter

func WithTweetFilter(filter func(*TweetQuery) (*TweetQuery, error)) TweetPaginateOption

WithTweetFilter configures pagination filter.

func WithTweetOrder

func WithTweetOrder(order *TweetOrder) TweetPaginateOption

WithTweetOrder configures pagination ordering.

type TweetQuery

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

TweetQuery is the builder for querying Tweet entities.

func (*TweetQuery) Aggregate

func (tq *TweetQuery) Aggregate(fns ...AggregateFunc) *TweetSelect

Aggregate returns a TweetSelect configured with the given aggregations.

func (*TweetQuery) All

func (tq *TweetQuery) All(ctx context.Context) ([]*Tweet, error)

All executes the query and returns a list of Tweets.

func (*TweetQuery) AllX

func (tq *TweetQuery) AllX(ctx context.Context) []*Tweet

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

func (*TweetQuery) Clone

func (tq *TweetQuery) Clone() *TweetQuery

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

func (*TweetQuery) CollectFields

func (t *TweetQuery) CollectFields(ctx context.Context, satisfies ...string) (*TweetQuery, error)

CollectFields tells the query-builder to eagerly load connected nodes by resolver context.

func (*TweetQuery) Count

func (tq *TweetQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*TweetQuery) CountX

func (tq *TweetQuery) CountX(ctx context.Context) int

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

func (*TweetQuery) Exist

func (tq *TweetQuery) Exist(ctx context.Context) (bool, error)

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

func (*TweetQuery) ExistX

func (tq *TweetQuery) ExistX(ctx context.Context) bool

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

func (*TweetQuery) Filter

func (tq *TweetQuery) Filter() *TweetFilter

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

func (*TweetQuery) First

func (tq *TweetQuery) First(ctx context.Context) (*Tweet, error)

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

func (*TweetQuery) FirstID

func (tq *TweetQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*TweetQuery) FirstIDX

func (tq *TweetQuery) FirstIDX(ctx context.Context) int

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

func (*TweetQuery) FirstX

func (tq *TweetQuery) FirstX(ctx context.Context) *Tweet

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

func (*TweetQuery) GroupBy

func (tq *TweetQuery) GroupBy(field string, fields ...string) *TweetGroupBy

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

client.Tweet.Query().
	GroupBy(tweet.FieldText).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*TweetQuery) IDs

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

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

func (*TweetQuery) IDsX

func (tq *TweetQuery) IDsX(ctx context.Context) []int

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

func (*TweetQuery) Limit

func (tq *TweetQuery) Limit(limit int) *TweetQuery

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

func (*TweetQuery) Offset

func (tq *TweetQuery) Offset(offset int) *TweetQuery

Offset to start from.

func (*TweetQuery) Only

func (tq *TweetQuery) Only(ctx context.Context) (*Tweet, error)

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

func (*TweetQuery) OnlyID

func (tq *TweetQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*TweetQuery) OnlyIDX

func (tq *TweetQuery) OnlyIDX(ctx context.Context) int

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

func (*TweetQuery) OnlyX

func (tq *TweetQuery) OnlyX(ctx context.Context) *Tweet

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

func (*TweetQuery) Order

func (tq *TweetQuery) Order(o ...tweet.OrderOption) *TweetQuery

Order specifies how the records should be ordered.

func (*TweetQuery) Paginate

func (t *TweetQuery) Paginate(
	ctx context.Context, after *Cursor, first *int,
	before *Cursor, last *int, opts ...TweetPaginateOption,
) (*TweetConnection, error)

Paginate executes the query and returns a relay based cursor connection to Tweet.

func (*TweetQuery) QueryLikedUsers

func (tq *TweetQuery) QueryLikedUsers() *UserQuery

QueryLikedUsers chains the current query on the "liked_users" edge.

func (*TweetQuery) QueryLikes

func (tq *TweetQuery) QueryLikes() *LikeQuery

QueryLikes chains the current query on the "likes" edge.

func (*TweetQuery) Select

func (tq *TweetQuery) Select(fields ...string) *TweetSelect

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

client.Tweet.Query().
	Select(tweet.FieldText).
	Scan(ctx, &v)

func (*TweetQuery) Unique

func (tq *TweetQuery) Unique(unique bool) *TweetQuery

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

func (tq *TweetQuery) Where(ps ...predicate.Tweet) *TweetQuery

Where adds a new predicate for the TweetQuery builder.

func (*TweetQuery) WithLikedUsers

func (tq *TweetQuery) WithLikedUsers(opts ...func(*UserQuery)) *TweetQuery

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

func (*TweetQuery) WithLikes

func (tq *TweetQuery) WithLikes(opts ...func(*LikeQuery)) *TweetQuery

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

func (*TweetQuery) WithNamedLikedUsers

func (tq *TweetQuery) WithNamedLikedUsers(name string, opts ...func(*UserQuery)) *TweetQuery

WithNamedLikedUsers tells the query-builder to eager-load the nodes that are connected to the "liked_users" edge with the given name. The optional arguments are used to configure the query builder of the edge.

func (*TweetQuery) WithNamedLikes

func (tq *TweetQuery) WithNamedLikes(name string, opts ...func(*LikeQuery)) *TweetQuery

WithNamedLikes tells the query-builder to eager-load the nodes that are connected to the "likes" edge with the given name. The optional arguments are used to configure the query builder of the edge.

type TweetSelect

type TweetSelect struct {
	*TweetQuery
	// contains filtered or unexported fields
}

TweetSelect is the builder for selecting fields of Tweet entities.

func (*TweetSelect) Aggregate

func (ts *TweetSelect) Aggregate(fns ...AggregateFunc) *TweetSelect

Aggregate adds the given aggregation functions to the selector query.

func (*TweetSelect) Bool

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

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

func (*TweetSelect) BoolX

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

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

func (*TweetSelect) Bools

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

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

func (*TweetSelect) BoolsX

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

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

func (*TweetSelect) Float64

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

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

func (*TweetSelect) Float64X

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

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

func (*TweetSelect) Float64s

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

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

func (*TweetSelect) Float64sX

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

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

func (*TweetSelect) Int

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

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

func (*TweetSelect) IntX

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

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

func (*TweetSelect) Ints

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

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

func (*TweetSelect) IntsX

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

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

func (*TweetSelect) Scan

func (ts *TweetSelect) Scan(ctx context.Context, v any) error

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

func (*TweetSelect) ScanX

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

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

func (*TweetSelect) String

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

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

func (*TweetSelect) StringX

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

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

func (*TweetSelect) Strings

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

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

func (*TweetSelect) StringsX

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

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

type TweetUpdate

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

TweetUpdate is the builder for updating Tweet entities.

func (*TweetUpdate) AddLikedUserIDs

func (tu *TweetUpdate) AddLikedUserIDs(ids ...int) *TweetUpdate

AddLikedUserIDs adds the "liked_users" edge to the User entity by IDs.

func (*TweetUpdate) AddLikedUsers

func (tu *TweetUpdate) AddLikedUsers(u ...*User) *TweetUpdate

AddLikedUsers adds the "liked_users" edges to the User entity.

func (*TweetUpdate) ClearLikedUsers

func (tu *TweetUpdate) ClearLikedUsers() *TweetUpdate

ClearLikedUsers clears all "liked_users" edges to the User entity.

func (*TweetUpdate) Exec

func (tu *TweetUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*TweetUpdate) ExecX

func (tu *TweetUpdate) ExecX(ctx context.Context)

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

func (*TweetUpdate) Mutation

func (tu *TweetUpdate) Mutation() *TweetMutation

Mutation returns the TweetMutation object of the builder.

func (*TweetUpdate) RemoveLikedUserIDs

func (tu *TweetUpdate) RemoveLikedUserIDs(ids ...int) *TweetUpdate

RemoveLikedUserIDs removes the "liked_users" edge to User entities by IDs.

func (*TweetUpdate) RemoveLikedUsers

func (tu *TweetUpdate) RemoveLikedUsers(u ...*User) *TweetUpdate

RemoveLikedUsers removes "liked_users" edges to User entities.

func (*TweetUpdate) Save

func (tu *TweetUpdate) Save(ctx context.Context) (int, error)

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

func (*TweetUpdate) SaveX

func (tu *TweetUpdate) SaveX(ctx context.Context) int

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

func (*TweetUpdate) SetNillableText

func (tu *TweetUpdate) SetNillableText(s *string) *TweetUpdate

SetNillableText sets the "text" field if the given value is not nil.

func (*TweetUpdate) SetText

func (tu *TweetUpdate) SetText(s string) *TweetUpdate

SetText sets the "text" field.

func (*TweetUpdate) Where

func (tu *TweetUpdate) Where(ps ...predicate.Tweet) *TweetUpdate

Where appends a list predicates to the TweetUpdate builder.

type TweetUpdateOne

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

TweetUpdateOne is the builder for updating a single Tweet entity.

func (*TweetUpdateOne) AddLikedUserIDs

func (tuo *TweetUpdateOne) AddLikedUserIDs(ids ...int) *TweetUpdateOne

AddLikedUserIDs adds the "liked_users" edge to the User entity by IDs.

func (*TweetUpdateOne) AddLikedUsers

func (tuo *TweetUpdateOne) AddLikedUsers(u ...*User) *TweetUpdateOne

AddLikedUsers adds the "liked_users" edges to the User entity.

func (*TweetUpdateOne) ClearLikedUsers

func (tuo *TweetUpdateOne) ClearLikedUsers() *TweetUpdateOne

ClearLikedUsers clears all "liked_users" edges to the User entity.

func (*TweetUpdateOne) Exec

func (tuo *TweetUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*TweetUpdateOne) ExecX

func (tuo *TweetUpdateOne) ExecX(ctx context.Context)

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

func (*TweetUpdateOne) Mutation

func (tuo *TweetUpdateOne) Mutation() *TweetMutation

Mutation returns the TweetMutation object of the builder.

func (*TweetUpdateOne) RemoveLikedUserIDs

func (tuo *TweetUpdateOne) RemoveLikedUserIDs(ids ...int) *TweetUpdateOne

RemoveLikedUserIDs removes the "liked_users" edge to User entities by IDs.

func (*TweetUpdateOne) RemoveLikedUsers

func (tuo *TweetUpdateOne) RemoveLikedUsers(u ...*User) *TweetUpdateOne

RemoveLikedUsers removes "liked_users" edges to User entities.

func (*TweetUpdateOne) Save

func (tuo *TweetUpdateOne) Save(ctx context.Context) (*Tweet, error)

Save executes the query and returns the updated Tweet entity.

func (*TweetUpdateOne) SaveX

func (tuo *TweetUpdateOne) SaveX(ctx context.Context) *Tweet

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

func (*TweetUpdateOne) Select

func (tuo *TweetUpdateOne) Select(field string, fields ...string) *TweetUpdateOne

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

func (*TweetUpdateOne) SetNillableText

func (tuo *TweetUpdateOne) SetNillableText(s *string) *TweetUpdateOne

SetNillableText sets the "text" field if the given value is not nil.

func (*TweetUpdateOne) SetText

func (tuo *TweetUpdateOne) SetText(s string) *TweetUpdateOne

SetText sets the "text" field.

func (*TweetUpdateOne) Where

func (tuo *TweetUpdateOne) Where(ps ...predicate.Tweet) *TweetUpdateOne

Where appends a list predicates to the TweetUpdate builder.

type TweetUpsert

type TweetUpsert struct {
	*sql.UpdateSet
}

TweetUpsert is the "OnConflict" setter.

func (*TweetUpsert) SetText

func (u *TweetUpsert) SetText(v string) *TweetUpsert

SetText sets the "text" field.

func (*TweetUpsert) UpdateText

func (u *TweetUpsert) UpdateText() *TweetUpsert

UpdateText sets the "text" field to the value that was provided on create.

type TweetUpsertBulk

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

TweetUpsertBulk is the builder for "upsert"-ing a bulk of Tweet nodes.

func (*TweetUpsertBulk) DoNothing

func (u *TweetUpsertBulk) DoNothing() *TweetUpsertBulk

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

func (*TweetUpsertBulk) Exec

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

Exec executes the query.

func (*TweetUpsertBulk) ExecX

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

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

func (*TweetUpsertBulk) Ignore

func (u *TweetUpsertBulk) Ignore() *TweetUpsertBulk

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

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

func (*TweetUpsertBulk) SetText

func (u *TweetUpsertBulk) SetText(v string) *TweetUpsertBulk

SetText sets the "text" field.

func (*TweetUpsertBulk) Update

func (u *TweetUpsertBulk) Update(set func(*TweetUpsert)) *TweetUpsertBulk

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

func (*TweetUpsertBulk) UpdateNewValues

func (u *TweetUpsertBulk) UpdateNewValues() *TweetUpsertBulk

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

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

func (*TweetUpsertBulk) UpdateText

func (u *TweetUpsertBulk) UpdateText() *TweetUpsertBulk

UpdateText sets the "text" field to the value that was provided on create.

type TweetUpsertOne

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

TweetUpsertOne is the builder for "upsert"-ing

one Tweet node.

func (*TweetUpsertOne) DoNothing

func (u *TweetUpsertOne) DoNothing() *TweetUpsertOne

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

func (*TweetUpsertOne) Exec

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

Exec executes the query.

func (*TweetUpsertOne) ExecX

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

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

func (*TweetUpsertOne) ID

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

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

func (*TweetUpsertOne) IDX

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

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

func (*TweetUpsertOne) Ignore

func (u *TweetUpsertOne) Ignore() *TweetUpsertOne

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

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

func (*TweetUpsertOne) SetText

func (u *TweetUpsertOne) SetText(v string) *TweetUpsertOne

SetText sets the "text" field.

func (*TweetUpsertOne) Update

func (u *TweetUpsertOne) Update(set func(*TweetUpsert)) *TweetUpsertOne

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

func (*TweetUpsertOne) UpdateNewValues

func (u *TweetUpsertOne) UpdateNewValues() *TweetUpsertOne

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

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

func (*TweetUpsertOne) UpdateText

func (u *TweetUpsertOne) UpdateText() *TweetUpsertOne

UpdateText sets the "text" field to the value that was provided on create.

type TweetWhereInput

type TweetWhereInput struct {
	Predicates []predicate.Tweet  `json:"-"`
	Not        *TweetWhereInput   `json:"not,omitempty"`
	Or         []*TweetWhereInput `json:"or,omitempty"`
	And        []*TweetWhereInput `json:"and,omitempty"`

	// "id" field predicates.
	ID      *int  `json:"id,omitempty"`
	IDNEQ   *int  `json:"idNEQ,omitempty"`
	IDIn    []int `json:"idIn,omitempty"`
	IDNotIn []int `json:"idNotIn,omitempty"`
	IDGT    *int  `json:"idGT,omitempty"`
	IDGTE   *int  `json:"idGTE,omitempty"`
	IDLT    *int  `json:"idLT,omitempty"`
	IDLTE   *int  `json:"idLTE,omitempty"`

	// "text" field predicates.
	Text             *string  `json:"text,omitempty"`
	TextNEQ          *string  `json:"textNEQ,omitempty"`
	TextIn           []string `json:"textIn,omitempty"`
	TextNotIn        []string `json:"textNotIn,omitempty"`
	TextGT           *string  `json:"textGT,omitempty"`
	TextGTE          *string  `json:"textGTE,omitempty"`
	TextLT           *string  `json:"textLT,omitempty"`
	TextLTE          *string  `json:"textLTE,omitempty"`
	TextContains     *string  `json:"textContains,omitempty"`
	TextHasPrefix    *string  `json:"textHasPrefix,omitempty"`
	TextHasSuffix    *string  `json:"textHasSuffix,omitempty"`
	TextEqualFold    *string  `json:"textEqualFold,omitempty"`
	TextContainsFold *string  `json:"textContainsFold,omitempty"`

	// "liked_users" edge predicates.
	HasLikedUsers     *bool             `json:"hasLikedUsers,omitempty"`
	HasLikedUsersWith []*UserWhereInput `json:"hasLikedUsersWith,omitempty"`
}

TweetWhereInput represents a where input for filtering Tweet queries.

func (*TweetWhereInput) AddPredicates

func (i *TweetWhereInput) AddPredicates(predicates ...predicate.Tweet)

AddPredicates adds custom predicates to the where input to be used during the filtering phase.

func (*TweetWhereInput) Filter

func (i *TweetWhereInput) Filter(q *TweetQuery) (*TweetQuery, error)

Filter applies the TweetWhereInput filter on the TweetQuery builder.

func (*TweetWhereInput) P

P returns a predicate for filtering tweets. An error is returned if the input is empty or invalid.

type Tweets

type Tweets []*Tweet

Tweets is a parsable slice of Tweet.

type Tx

type Tx struct {

	// Like is the client for interacting with the Like builders.
	Like *LikeClient
	// Tweet is the client for interacting with the Tweet builders.
	Tweet *TweetClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

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

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Age holds the value of the "age" field.
	Age int `json:"age,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) IsNode

func (n *User) IsNode()

IsNode implements the Node interface check for GQLGen.

func (*User) LikedTweets

func (u *User) LikedTweets(ctx context.Context) (result []*Tweet, err error)

func (*User) NamedLikedTweets

func (u *User) NamedLikedTweets(name string) ([]*Tweet, error)

NamedLikedTweets returns the LikedTweets named value or an error if the edge was not loaded in eager-loading with this name.

func (*User) QueryLikedTweets

func (u *User) QueryLikedTweets() *TweetQuery

QueryLikedTweets queries the "liked_tweets" edge of the User entity.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) ToEdge

func (u *User) ToEdge(order *UserOrder) *UserEdge

ToEdge converts User into UserEdge.

func (*User) Unwrap

func (u *User) Unwrap() *User

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

func (*User) Update

func (u *User) Update() *UserUpdateOne

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

func (*User) Value

func (u *User) Value(name string) (ent.Value, error)

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

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

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

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

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

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int) *User

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) 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) MapCreateBulk

func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryLikedTweets

func (c *UserClient) QueryLikedTweets(u *User) *TweetQuery

QueryLikedTweets queries the liked_tweets edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id int) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

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

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

type UserConnection

type UserConnection struct {
	Edges      []*UserEdge `json:"edges"`
	PageInfo   PageInfo    `json:"pageInfo"`
	TotalCount int         `json:"totalCount"`
}

UserConnection is the connection containing edges to User.

type UserCreate

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

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddLikedTweetIDs

func (uc *UserCreate) AddLikedTweetIDs(ids ...int) *UserCreate

AddLikedTweetIDs adds the "liked_tweets" edge to the Tweet entity by IDs.

func (*UserCreate) AddLikedTweets

func (uc *UserCreate) AddLikedTweets(t ...*Tweet) *UserCreate

AddLikedTweets adds the "liked_tweets" edges to the Tweet 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().
	SetAge(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) {
		SetAge(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) SetAge

func (uc *UserCreate) SetAge(i int) *UserCreate

SetAge sets the "age" field.

func (*UserCreate) SetName

func (uc *UserCreate) SetName(s string) *UserCreate

SetName sets the "name" 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) {
		SetAge(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 UserEdge

type UserEdge struct {
	Node   *User  `json:"node"`
	Cursor Cursor `json:"cursor"`
}

UserEdge is the edge representation of User.

type UserEdges

type UserEdges struct {
	// LikedTweets holds the value of the liked_tweets edge.
	LikedTweets []*Tweet `json:"liked_tweets,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserEdges) LikedTweetsOrErr

func (e UserEdges) LikedTweetsOrErr() ([]*Tweet, error)

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

type UserFilter

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

UserFilter provides a generic filtering capability at runtime for UserQuery.

func (*UserFilter) Where

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

Where applies the entql predicate on the query filter.

func (*UserFilter) WhereAge

func (f *UserFilter) WhereAge(p entql.IntP)

WhereAge applies the entql int predicate on the age field.

func (*UserFilter) WhereHasLikedTweets

func (f *UserFilter) WhereHasLikedTweets()

WhereHasLikedTweets applies a predicate to check if query has an edge liked_tweets.

func (*UserFilter) WhereHasLikedTweetsWith

func (f *UserFilter) WhereHasLikedTweetsWith(preds ...predicate.Tweet)

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

func (*UserFilter) WhereID

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

WhereID applies the entql int predicate on the id field.

func (*UserFilter) WhereName

func (f *UserFilter) WhereName(p entql.StringP)

WhereName applies the entql string predicate on the name field.

type UserGroupBy

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

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

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

func (*UserGroupBy) Bool

func (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) AddAge

func (m *UserMutation) AddAge(i int)

AddAge adds i to the "age" field.

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

func (m *UserMutation) AddLikedTweetIDs(ids ...int)

AddLikedTweetIDs adds the "liked_tweets" edge to the Tweet entity by ids.

func (*UserMutation) AddedAge

func (m *UserMutation) AddedAge() (r int, exists bool)

AddedAge returns the value that was added to the "age" field in this mutation.

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

func (m *UserMutation) Age() (r int, exists bool)

Age returns the value of the "age" field in the 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) ClearLikedTweets

func (m *UserMutation) ClearLikedTweets()

ClearLikedTweets clears the "liked_tweets" edge to the Tweet entity.

func (*UserMutation) ClearedEdges

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

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

func (*UserMutation) ClearedFields

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

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

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) EdgeCleared

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

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

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

func (m *UserMutation) Filter() *UserFilter

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

func (*UserMutation) ID

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

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

func (*UserMutation) IDs

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

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

func (*UserMutation) LikedTweetsCleared

func (m *UserMutation) LikedTweetsCleared() bool

LikedTweetsCleared reports if the "liked_tweets" edge to the Tweet entity was cleared.

func (*UserMutation) LikedTweetsIDs

func (m *UserMutation) LikedTweetsIDs() (ids []int)

LikedTweetsIDs returns the "liked_tweets" edge IDs in the mutation.

func (*UserMutation) Name

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

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

func (*UserMutation) OldAge

func (m *UserMutation) OldAge(ctx context.Context) (v int, err error)

OldAge returns the old "age" 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) OldName

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

OldName returns the old "name" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) RemoveLikedTweetIDs

func (m *UserMutation) RemoveLikedTweetIDs(ids ...int)

RemoveLikedTweetIDs removes the "liked_tweets" edge to the Tweet entity by IDs.

func (*UserMutation) RemovedEdges

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

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

func (*UserMutation) RemovedIDs

func (m *UserMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserMutation) RemovedLikedTweetsIDs

func (m *UserMutation) RemovedLikedTweetsIDs() (ids []int)

RemovedLikedTweets returns the removed IDs of the "liked_tweets" edge to the Tweet entity.

func (*UserMutation) ResetAge

func (m *UserMutation) ResetAge()

ResetAge resets all changes to the "age" 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) ResetLikedTweets

func (m *UserMutation) ResetLikedTweets()

ResetLikedTweets resets all changes to the "liked_tweets" edge.

func (*UserMutation) ResetName

func (m *UserMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMutation) SetAge

func (m *UserMutation) SetAge(i int)

SetAge sets the "age" 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) SetName

func (m *UserMutation) SetName(s string)

SetName sets the "name" field.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

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

type UserOrder struct {
	Direction OrderDirection  `json:"direction"`
	Field     *UserOrderField `json:"field"`
}

UserOrder defines the ordering of User.

type UserOrderField

type UserOrderField struct {
	// Value extracts the ordering value from the given User.
	Value func(*User) (ent.Value, error)
	// contains filtered or unexported fields
}

UserOrderField defines the ordering field of User.

func (UserOrderField) MarshalGQL

func (f UserOrderField) MarshalGQL(w io.Writer)

MarshalGQL implements graphql.Marshaler interface.

func (UserOrderField) String

func (f UserOrderField) String() string

String implement fmt.Stringer interface.

func (*UserOrderField) UnmarshalGQL

func (f *UserOrderField) UnmarshalGQL(v interface{}) error

UnmarshalGQL implements graphql.Unmarshaler interface.

type UserPaginateOption

type UserPaginateOption func(*userPager) error

UserPaginateOption enables pagination customization.

func WithUserFilter

func WithUserFilter(filter func(*UserQuery) (*UserQuery, error)) UserPaginateOption

WithUserFilter configures pagination filter.

func WithUserOrder

func WithUserOrder(order *UserOrder) UserPaginateOption

WithUserOrder configures pagination ordering.

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

func (u *UserQuery) CollectFields(ctx context.Context, satisfies ...string) (*UserQuery, error)

CollectFields tells the query-builder to eagerly load connected nodes by resolver context.

func (*UserQuery) Count

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

Count returns the count of the given query.

func (*UserQuery) CountX

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

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

func (*UserQuery) Exist

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

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

func (*UserQuery) ExistX

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

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

func (*UserQuery) Filter

func (uq *UserQuery) Filter() *UserFilter

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

func (*UserQuery) First

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

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

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*UserQuery) FirstIDX

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

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

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Age int `json:"age,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldAge).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

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

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

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int

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

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit 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 int, err error)

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

func (*UserQuery) OnlyIDX

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

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

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

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

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) Paginate

func (u *UserQuery) Paginate(
	ctx context.Context, after *Cursor, first *int,
	before *Cursor, last *int, opts ...UserPaginateOption,
) (*UserConnection, error)

Paginate executes the query and returns a relay based cursor connection to User.

func (*UserQuery) QueryLikedTweets

func (uq *UserQuery) QueryLikedTweets() *TweetQuery

QueryLikedTweets chains the current query on the "liked_tweets" edge.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *UserSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Age int `json:"age,omitempty"`
}

client.User.Query().
	Select(user.FieldAge).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *UserQuery) Unique(unique bool) *UserQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithLikedTweets

func (uq *UserQuery) WithLikedTweets(opts ...func(*TweetQuery)) *UserQuery

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

func (*UserQuery) WithNamedLikedTweets

func (uq *UserQuery) WithNamedLikedTweets(name string, opts ...func(*TweetQuery)) *UserQuery

WithNamedLikedTweets tells the query-builder to eager-load the nodes that are connected to the "liked_tweets" edge with the given name. The optional arguments are used to configure the query builder of the edge.

type UserSelect

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

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

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

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

func (*UserSelect) BoolX

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

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

func (*UserSelect) Bools

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

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

func (*UserSelect) BoolsX

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

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

func (*UserSelect) Float64

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

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

func (*UserSelect) Float64X

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

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

func (*UserSelect) Float64s

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

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

func (*UserSelect) Float64sX

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

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

func (*UserSelect) Int

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

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

func (*UserSelect) IntX

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

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

func (*UserSelect) Ints

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

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

func (*UserSelect) IntsX

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

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

func (*UserSelect) Scan

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

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

func (*UserSelect) ScanX

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

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

func (*UserSelect) String

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

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

func (*UserSelect) StringX

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

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

func (*UserSelect) Strings

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

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

func (*UserSelect) StringsX

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

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

type UserUpdate

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

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddAge

func (uu *UserUpdate) AddAge(i int) *UserUpdate

AddAge adds i to the "age" field.

func (*UserUpdate) AddLikedTweetIDs

func (uu *UserUpdate) AddLikedTweetIDs(ids ...int) *UserUpdate

AddLikedTweetIDs adds the "liked_tweets" edge to the Tweet entity by IDs.

func (*UserUpdate) AddLikedTweets

func (uu *UserUpdate) AddLikedTweets(t ...*Tweet) *UserUpdate

AddLikedTweets adds the "liked_tweets" edges to the Tweet entity.

func (*UserUpdate) ClearLikedTweets

func (uu *UserUpdate) ClearLikedTweets() *UserUpdate

ClearLikedTweets clears all "liked_tweets" edges to the Tweet entity.

func (*UserUpdate) Exec

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

Exec executes the query.

func (*UserUpdate) ExecX

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

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

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveLikedTweetIDs

func (uu *UserUpdate) RemoveLikedTweetIDs(ids ...int) *UserUpdate

RemoveLikedTweetIDs removes the "liked_tweets" edge to Tweet entities by IDs.

func (*UserUpdate) RemoveLikedTweets

func (uu *UserUpdate) RemoveLikedTweets(t ...*Tweet) *UserUpdate

RemoveLikedTweets removes "liked_tweets" edges to Tweet entities.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

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

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

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

func (*UserUpdate) SetAge

func (uu *UserUpdate) SetAge(i int) *UserUpdate

SetAge sets the "age" field.

func (*UserUpdate) SetName

func (uu *UserUpdate) SetName(s string) *UserUpdate

SetName sets the "name" field.

func (*UserUpdate) SetNillableAge

func (uu *UserUpdate) SetNillableAge(i *int) *UserUpdate

SetNillableAge sets the "age" field if the given value is not nil.

func (*UserUpdate) SetNillableName

func (uu *UserUpdate) SetNillableName(s *string) *UserUpdate

SetNillableName sets the "name" field if the given value is not nil.

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

func (uuo *UserUpdateOne) AddAge(i int) *UserUpdateOne

AddAge adds i to the "age" field.

func (*UserUpdateOne) AddLikedTweetIDs

func (uuo *UserUpdateOne) AddLikedTweetIDs(ids ...int) *UserUpdateOne

AddLikedTweetIDs adds the "liked_tweets" edge to the Tweet entity by IDs.

func (*UserUpdateOne) AddLikedTweets

func (uuo *UserUpdateOne) AddLikedTweets(t ...*Tweet) *UserUpdateOne

AddLikedTweets adds the "liked_tweets" edges to the Tweet entity.

func (*UserUpdateOne) ClearLikedTweets

func (uuo *UserUpdateOne) ClearLikedTweets() *UserUpdateOne

ClearLikedTweets clears all "liked_tweets" edges to the Tweet 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) RemoveLikedTweetIDs

func (uuo *UserUpdateOne) RemoveLikedTweetIDs(ids ...int) *UserUpdateOne

RemoveLikedTweetIDs removes the "liked_tweets" edge to Tweet entities by IDs.

func (*UserUpdateOne) RemoveLikedTweets

func (uuo *UserUpdateOne) RemoveLikedTweets(t ...*Tweet) *UserUpdateOne

RemoveLikedTweets removes "liked_tweets" edges to Tweet entities.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

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

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

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

func (*UserUpdateOne) SetAge

func (uuo *UserUpdateOne) SetAge(i int) *UserUpdateOne

SetAge sets the "age" field.

func (*UserUpdateOne) SetName

func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne

SetName sets the "name" field.

func (*UserUpdateOne) SetNillableAge

func (uuo *UserUpdateOne) SetNillableAge(i *int) *UserUpdateOne

SetNillableAge sets the "age" field if the given value is not nil.

func (*UserUpdateOne) SetNillableName

func (uuo *UserUpdateOne) SetNillableName(s *string) *UserUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

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

func (u *UserUpsert) AddAge(v int) *UserUpsert

AddAge adds v to the "age" field.

func (*UserUpsert) SetAge

func (u *UserUpsert) SetAge(v int) *UserUpsert

SetAge sets the "age" field.

func (*UserUpsert) SetName

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

SetName sets the "name" field.

func (*UserUpsert) UpdateAge

func (u *UserUpsert) UpdateAge() *UserUpsert

UpdateAge sets the "age" field to the value that was provided on create.

func (*UserUpsert) UpdateName

func (u *UserUpsert) UpdateName() *UserUpsert

UpdateName sets the "name" 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) AddAge

func (u *UserUpsertBulk) AddAge(v int) *UserUpsertBulk

AddAge adds v to the "age" field.

func (*UserUpsertBulk) DoNothing

func (u *UserUpsertBulk) DoNothing() *UserUpsertBulk

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

func (*UserUpsertBulk) Exec

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

Exec executes the query.

func (*UserUpsertBulk) ExecX

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

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

func (*UserUpsertBulk) Ignore

func (u *UserUpsertBulk) Ignore() *UserUpsertBulk

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

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

func (*UserUpsertBulk) SetAge

func (u *UserUpsertBulk) SetAge(v int) *UserUpsertBulk

SetAge sets the "age" field.

func (*UserUpsertBulk) SetName

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

SetName sets the "name" 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) UpdateAge

func (u *UserUpsertBulk) UpdateAge() *UserUpsertBulk

UpdateAge sets the "age" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateName

func (u *UserUpsertBulk) UpdateName() *UserUpsertBulk

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

func (*UserUpsertBulk) UpdateNewValues

func (u *UserUpsertBulk) UpdateNewValues() *UserUpsertBulk

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

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

type UserUpsertOne

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

UserUpsertOne is the builder for "upsert"-ing

one User node.

func (*UserUpsertOne) AddAge

func (u *UserUpsertOne) AddAge(v int) *UserUpsertOne

AddAge adds v to the "age" field.

func (*UserUpsertOne) DoNothing

func (u *UserUpsertOne) DoNothing() *UserUpsertOne

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

func (*UserUpsertOne) Exec

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

Exec executes the query.

func (*UserUpsertOne) ExecX

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

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

func (*UserUpsertOne) ID

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

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

func (*UserUpsertOne) IDX

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

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

func (*UserUpsertOne) Ignore

func (u *UserUpsertOne) Ignore() *UserUpsertOne

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

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

func (*UserUpsertOne) SetAge

func (u *UserUpsertOne) SetAge(v int) *UserUpsertOne

SetAge sets the "age" field.

func (*UserUpsertOne) SetName

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

SetName sets the "name" 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) UpdateAge

func (u *UserUpsertOne) UpdateAge() *UserUpsertOne

UpdateAge sets the "age" field to the value that was provided on create.

func (*UserUpsertOne) UpdateName

func (u *UserUpsertOne) UpdateName() *UserUpsertOne

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

func (*UserUpsertOne) UpdateNewValues

func (u *UserUpsertOne) UpdateNewValues() *UserUpsertOne

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

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

type UserWhereInput

type UserWhereInput struct {
	Predicates []predicate.User  `json:"-"`
	Not        *UserWhereInput   `json:"not,omitempty"`
	Or         []*UserWhereInput `json:"or,omitempty"`
	And        []*UserWhereInput `json:"and,omitempty"`

	// "id" field predicates.
	ID      *int  `json:"id,omitempty"`
	IDNEQ   *int  `json:"idNEQ,omitempty"`
	IDIn    []int `json:"idIn,omitempty"`
	IDNotIn []int `json:"idNotIn,omitempty"`
	IDGT    *int  `json:"idGT,omitempty"`
	IDGTE   *int  `json:"idGTE,omitempty"`
	IDLT    *int  `json:"idLT,omitempty"`
	IDLTE   *int  `json:"idLTE,omitempty"`

	// "age" field predicates.
	Age      *int  `json:"age,omitempty"`
	AgeNEQ   *int  `json:"ageNEQ,omitempty"`
	AgeIn    []int `json:"ageIn,omitempty"`
	AgeNotIn []int `json:"ageNotIn,omitempty"`
	AgeGT    *int  `json:"ageGT,omitempty"`
	AgeGTE   *int  `json:"ageGTE,omitempty"`
	AgeLT    *int  `json:"ageLT,omitempty"`
	AgeLTE   *int  `json:"ageLTE,omitempty"`

	// "name" field predicates.
	Name             *string  `json:"name,omitempty"`
	NameNEQ          *string  `json:"nameNEQ,omitempty"`
	NameIn           []string `json:"nameIn,omitempty"`
	NameNotIn        []string `json:"nameNotIn,omitempty"`
	NameGT           *string  `json:"nameGT,omitempty"`
	NameGTE          *string  `json:"nameGTE,omitempty"`
	NameLT           *string  `json:"nameLT,omitempty"`
	NameLTE          *string  `json:"nameLTE,omitempty"`
	NameContains     *string  `json:"nameContains,omitempty"`
	NameHasPrefix    *string  `json:"nameHasPrefix,omitempty"`
	NameHasSuffix    *string  `json:"nameHasSuffix,omitempty"`
	NameEqualFold    *string  `json:"nameEqualFold,omitempty"`
	NameContainsFold *string  `json:"nameContainsFold,omitempty"`

	// "liked_tweets" edge predicates.
	HasLikedTweets     *bool              `json:"hasLikedTweets,omitempty"`
	HasLikedTweetsWith []*TweetWhereInput `json:"hasLikedTweetsWith,omitempty"`
}

UserWhereInput represents a where input for filtering User queries.

func (*UserWhereInput) AddPredicates

func (i *UserWhereInput) AddPredicates(predicates ...predicate.User)

AddPredicates adds custom predicates to the where input to be used during the filtering phase.

func (*UserWhereInput) Filter

func (i *UserWhereInput) Filter(q *UserQuery) (*UserQuery, error)

Filter applies the UserWhereInput filter on the UserQuery builder.

func (*UserWhereInput) P

func (i *UserWhereInput) P() (predicate.User, error)

P returns a predicate for filtering users. An error is returned if the input is empty or invalid.

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