Documentation ¶
Index ¶
- Constants
- Variables
- func Asc(fields ...string) func(*sql.Selector)
- func Desc(fields ...string) func(*sql.Selector)
- func IsConstraintError(err error) bool
- func IsNotFound(err error) bool
- func IsNotLoaded(err error) bool
- func IsNotSingular(err error) bool
- func IsValidationError(err error) bool
- func MaskNotFound(err error) error
- func NewContext(parent context.Context, c *Client) context.Context
- func NewTxContext(parent context.Context, tx *Tx) context.Context
- func OpenTxFromContext(ctx context.Context) (context.Context, driver.Tx, error)
- type AggregateFunc
- type Client
- func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) Debug() *Client
- func (c *Client) Intercept(interceptors ...Interceptor)
- func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)
- func (c *Client) Noder(ctx context.Context, id int, opts ...NodeOption) (_ Noder, err error)
- func (c *Client) Noders(ctx context.Context, ids []int, opts ...NodeOption) ([]Noder, error)
- func (c *Client) OpenTx(ctx context.Context) (context.Context, driver.Tx, error)
- func (c *Client) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type CreateLikeInput
- type Cursor
- type Hook
- type InterceptFunc
- type Interceptor
- type Like
- type LikeClient
- func (c *LikeClient) Create() *LikeCreate
- func (c *LikeClient) CreateBulk(builders ...*LikeCreate) *LikeCreateBulk
- func (c *LikeClient) Delete() *LikeDelete
- func (c *LikeClient) Hooks() []Hook
- func (c *LikeClient) Intercept(interceptors ...Interceptor)
- func (c *LikeClient) Interceptors() []Interceptor
- func (c *LikeClient) MapCreateBulk(slice any, setFunc func(*LikeCreate, int)) *LikeCreateBulk
- func (c *LikeClient) Query() *LikeQuery
- func (c *LikeClient) QueryTweet(l *Like) *TweetQuery
- func (c *LikeClient) QueryUser(l *Like) *UserQuery
- func (c *LikeClient) Update() *LikeUpdate
- func (c *LikeClient) UpdateOne(l *Like) *LikeUpdateOne
- func (c *LikeClient) Use(hooks ...Hook)
- type LikeCreate
- func (lc *LikeCreate) Exec(ctx context.Context) error
- func (lc *LikeCreate) ExecX(ctx context.Context)
- func (lc *LikeCreate) Mutation() *LikeMutation
- func (lc *LikeCreate) OnConflict(opts ...sql.ConflictOption) *LikeUpsertOne
- func (lc *LikeCreate) OnConflictColumns(columns ...string) *LikeUpsertOne
- func (lc *LikeCreate) Save(ctx context.Context) (*Like, error)
- func (lc *LikeCreate) SaveX(ctx context.Context) *Like
- func (lc *LikeCreate) SetCreateTime(t time.Time) *LikeCreate
- func (c *LikeCreate) SetInput(i CreateLikeInput) *LikeCreate
- func (lc *LikeCreate) SetLikedAt(t time.Time) *LikeCreate
- func (lc *LikeCreate) SetNillableCreateTime(t *time.Time) *LikeCreate
- func (lc *LikeCreate) SetNillableLikedAt(t *time.Time) *LikeCreate
- func (lc *LikeCreate) SetNillableUpdateTime(t *time.Time) *LikeCreate
- func (lc *LikeCreate) SetTweet(t *Tweet) *LikeCreate
- func (lc *LikeCreate) SetTweetID(i int) *LikeCreate
- func (lc *LikeCreate) SetUpdateTime(t time.Time) *LikeCreate
- func (lc *LikeCreate) SetUser(u *User) *LikeCreate
- func (lc *LikeCreate) SetUserID(i int) *LikeCreate
- type LikeCreateBulk
- func (lcb *LikeCreateBulk) Exec(ctx context.Context) error
- func (lcb *LikeCreateBulk) ExecX(ctx context.Context)
- func (lcb *LikeCreateBulk) OnConflict(opts ...sql.ConflictOption) *LikeUpsertBulk
- func (lcb *LikeCreateBulk) OnConflictColumns(columns ...string) *LikeUpsertBulk
- func (lcb *LikeCreateBulk) Save(ctx context.Context) ([]*Like, error)
- func (lcb *LikeCreateBulk) SaveX(ctx context.Context) []*Like
- type LikeDelete
- type LikeDeleteOne
- type LikeEdges
- type LikeFilter
- func (f *LikeFilter) Where(p entql.P)
- func (f *LikeFilter) WhereCreateTime(p entql.TimeP)
- func (f *LikeFilter) WhereHasTweet()
- func (f *LikeFilter) WhereHasTweetWith(preds ...predicate.Tweet)
- func (f *LikeFilter) WhereHasUser()
- func (f *LikeFilter) WhereHasUserWith(preds ...predicate.User)
- func (f *LikeFilter) WhereLikedAt(p entql.TimeP)
- func (f *LikeFilter) WhereTweetID(p entql.IntP)
- func (f *LikeFilter) WhereUpdateTime(p entql.TimeP)
- func (f *LikeFilter) WhereUserID(p entql.IntP)
- type LikeGroupBy
- func (lgb *LikeGroupBy) Aggregate(fns ...AggregateFunc) *LikeGroupBy
- func (s *LikeGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *LikeGroupBy) BoolX(ctx context.Context) bool
- func (s *LikeGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *LikeGroupBy) BoolsX(ctx context.Context) []bool
- func (s *LikeGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *LikeGroupBy) Float64X(ctx context.Context) float64
- func (s *LikeGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *LikeGroupBy) Float64sX(ctx context.Context) []float64
- func (s *LikeGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *LikeGroupBy) IntX(ctx context.Context) int
- func (s *LikeGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *LikeGroupBy) IntsX(ctx context.Context) []int
- func (lgb *LikeGroupBy) Scan(ctx context.Context, v any) error
- func (s *LikeGroupBy) ScanX(ctx context.Context, v any)
- func (s *LikeGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *LikeGroupBy) StringX(ctx context.Context) string
- func (s *LikeGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *LikeGroupBy) StringsX(ctx context.Context) []string
- type LikeMutation
- func (m *LikeMutation) AddField(name string, value ent.Value) error
- func (m *LikeMutation) AddedEdges() []string
- func (m *LikeMutation) AddedField(name string) (ent.Value, bool)
- func (m *LikeMutation) AddedFields() []string
- func (m *LikeMutation) AddedIDs(name string) []ent.Value
- func (m *LikeMutation) ClearEdge(name string) error
- func (m *LikeMutation) ClearField(name string) error
- func (m *LikeMutation) ClearTweet()
- func (m *LikeMutation) ClearUser()
- func (m *LikeMutation) ClearedEdges() []string
- func (m *LikeMutation) ClearedFields() []string
- func (m LikeMutation) Client() *Client
- func (m *LikeMutation) CreateTime() (r time.Time, exists bool)
- func (m *LikeMutation) EdgeCleared(name string) bool
- func (m *LikeMutation) Field(name string) (ent.Value, bool)
- func (m *LikeMutation) FieldCleared(name string) bool
- func (m *LikeMutation) Fields() []string
- func (m *LikeMutation) Filter() *LikeFilter
- func (m *LikeMutation) LikedAt() (r time.Time, exists bool)
- func (m *LikeMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *LikeMutation) Op() Op
- func (m *LikeMutation) RemovedEdges() []string
- func (m *LikeMutation) RemovedIDs(name string) []ent.Value
- func (m *LikeMutation) ResetCreateTime()
- func (m *LikeMutation) ResetEdge(name string) error
- func (m *LikeMutation) ResetField(name string) error
- func (m *LikeMutation) ResetLikedAt()
- func (m *LikeMutation) ResetTweet()
- func (m *LikeMutation) ResetTweetID()
- func (m *LikeMutation) ResetUpdateTime()
- func (m *LikeMutation) ResetUser()
- func (m *LikeMutation) ResetUserID()
- func (m *LikeMutation) SetCreateTime(t time.Time)
- func (m *LikeMutation) SetField(name string, value ent.Value) error
- func (m *LikeMutation) SetLikedAt(t time.Time)
- func (m *LikeMutation) SetOp(op Op)
- func (m *LikeMutation) SetTweetID(i int)
- func (m *LikeMutation) SetUpdateTime(t time.Time)
- func (m *LikeMutation) SetUserID(i int)
- func (m *LikeMutation) TweetCleared() bool
- func (m *LikeMutation) TweetID() (r int, exists bool)
- func (m *LikeMutation) TweetIDs() (ids []int)
- func (m LikeMutation) Tx() (*Tx, error)
- func (m *LikeMutation) Type() string
- func (m *LikeMutation) UpdateTime() (r time.Time, exists bool)
- func (m *LikeMutation) UserCleared() bool
- func (m *LikeMutation) UserID() (r int, exists bool)
- func (m *LikeMutation) UserIDs() (ids []int)
- func (m *LikeMutation) Where(ps ...predicate.Like)
- func (m *LikeMutation) WhereP(ps ...func(*sql.Selector))
- type LikeQuery
- func (lq *LikeQuery) Aggregate(fns ...AggregateFunc) *LikeSelect
- func (lq *LikeQuery) All(ctx context.Context) ([]*Like, error)
- func (lq *LikeQuery) AllX(ctx context.Context) []*Like
- func (lq *LikeQuery) Clone() *LikeQuery
- func (lq *LikeQuery) Count(ctx context.Context) (int, error)
- func (lq *LikeQuery) CountX(ctx context.Context) int
- func (lq *LikeQuery) Exist(ctx context.Context) (bool, error)
- func (lq *LikeQuery) ExistX(ctx context.Context) bool
- func (lq *LikeQuery) Filter() *LikeFilter
- func (lq *LikeQuery) First(ctx context.Context) (*Like, error)
- func (lq *LikeQuery) FirstX(ctx context.Context) *Like
- func (lq *LikeQuery) GroupBy(field string, fields ...string) *LikeGroupBy
- func (lq *LikeQuery) Limit(limit int) *LikeQuery
- func (lq *LikeQuery) Offset(offset int) *LikeQuery
- func (lq *LikeQuery) Only(ctx context.Context) (*Like, error)
- func (lq *LikeQuery) OnlyX(ctx context.Context) *Like
- func (lq *LikeQuery) Order(o ...like.OrderOption) *LikeQuery
- func (lq *LikeQuery) QueryTweet() *TweetQuery
- func (lq *LikeQuery) QueryUser() *UserQuery
- func (lq *LikeQuery) Select(fields ...string) *LikeSelect
- func (lq *LikeQuery) Unique(unique bool) *LikeQuery
- func (lq *LikeQuery) Where(ps ...predicate.Like) *LikeQuery
- func (lq *LikeQuery) WithTweet(opts ...func(*TweetQuery)) *LikeQuery
- func (lq *LikeQuery) WithUser(opts ...func(*UserQuery)) *LikeQuery
- type LikeSelect
- func (ls *LikeSelect) Aggregate(fns ...AggregateFunc) *LikeSelect
- func (s *LikeSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *LikeSelect) BoolX(ctx context.Context) bool
- func (s *LikeSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *LikeSelect) BoolsX(ctx context.Context) []bool
- func (s *LikeSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *LikeSelect) Float64X(ctx context.Context) float64
- func (s *LikeSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *LikeSelect) Float64sX(ctx context.Context) []float64
- func (s *LikeSelect) Int(ctx context.Context) (_ int, err error)
- func (s *LikeSelect) IntX(ctx context.Context) int
- func (s *LikeSelect) Ints(ctx context.Context) ([]int, error)
- func (s *LikeSelect) IntsX(ctx context.Context) []int
- func (ls *LikeSelect) Scan(ctx context.Context, v any) error
- func (s *LikeSelect) ScanX(ctx context.Context, v any)
- func (s *LikeSelect) String(ctx context.Context) (_ string, err error)
- func (s *LikeSelect) StringX(ctx context.Context) string
- func (s *LikeSelect) Strings(ctx context.Context) ([]string, error)
- func (s *LikeSelect) StringsX(ctx context.Context) []string
- type LikeUpdate
- func (lu *LikeUpdate) Exec(ctx context.Context) error
- func (lu *LikeUpdate) ExecX(ctx context.Context)
- func (lu *LikeUpdate) Mutation() *LikeMutation
- func (lu *LikeUpdate) Save(ctx context.Context) (int, error)
- func (lu *LikeUpdate) SaveX(ctx context.Context) int
- func (lu *LikeUpdate) SetUpdateTime(t time.Time) *LikeUpdate
- func (lu *LikeUpdate) Where(ps ...predicate.Like) *LikeUpdate
- type LikeUpdateOne
- func (luo *LikeUpdateOne) Exec(ctx context.Context) error
- func (luo *LikeUpdateOne) ExecX(ctx context.Context)
- func (luo *LikeUpdateOne) Mutation() *LikeMutation
- func (luo *LikeUpdateOne) Save(ctx context.Context) (*Like, error)
- func (luo *LikeUpdateOne) SaveX(ctx context.Context) *Like
- func (luo *LikeUpdateOne) Select(field string, fields ...string) *LikeUpdateOne
- func (luo *LikeUpdateOne) SetUpdateTime(t time.Time) *LikeUpdateOne
- func (luo *LikeUpdateOne) Where(ps ...predicate.Like) *LikeUpdateOne
- type LikeUpsert
- type LikeUpsertBulk
- func (u *LikeUpsertBulk) DoNothing() *LikeUpsertBulk
- func (u *LikeUpsertBulk) Exec(ctx context.Context) error
- func (u *LikeUpsertBulk) ExecX(ctx context.Context)
- func (u *LikeUpsertBulk) Ignore() *LikeUpsertBulk
- func (u *LikeUpsertBulk) SetUpdateTime(v time.Time) *LikeUpsertBulk
- func (u *LikeUpsertBulk) Update(set func(*LikeUpsert)) *LikeUpsertBulk
- func (u *LikeUpsertBulk) UpdateNewValues() *LikeUpsertBulk
- func (u *LikeUpsertBulk) UpdateUpdateTime() *LikeUpsertBulk
- type LikeUpsertOne
- func (u *LikeUpsertOne) DoNothing() *LikeUpsertOne
- func (u *LikeUpsertOne) Exec(ctx context.Context) error
- func (u *LikeUpsertOne) ExecX(ctx context.Context)
- func (u *LikeUpsertOne) Ignore() *LikeUpsertOne
- func (u *LikeUpsertOne) SetUpdateTime(v time.Time) *LikeUpsertOne
- func (u *LikeUpsertOne) Update(set func(*LikeUpsert)) *LikeUpsertOne
- func (u *LikeUpsertOne) UpdateNewValues() *LikeUpsertOne
- func (u *LikeUpsertOne) UpdateUpdateTime() *LikeUpsertOne
- type Likes
- type MutateFunc
- type Mutation
- type Mutator
- type NodeOption
- type Noder
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderDirection
- type OrderFunc
- type PageInfo
- type Policy
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type TraverseFunc
- type Traverser
- type Tweet
- func (n *Tweet) IsNode()
- func (t *Tweet) LikedUsers(ctx context.Context) (result []*User, err error)
- func (t *Tweet) NamedLikedUsers(name string) ([]*User, error)
- func (t *Tweet) NamedLikes(name string) ([]*Like, error)
- func (t *Tweet) QueryLikedUsers() *UserQuery
- func (t *Tweet) QueryLikes() *LikeQuery
- func (t *Tweet) String() string
- func (t *Tweet) ToEdge(order *TweetOrder) *TweetEdge
- func (t *Tweet) Unwrap() *Tweet
- func (t *Tweet) Update() *TweetUpdateOne
- func (t *Tweet) Value(name string) (ent.Value, error)
- type TweetClient
- func (c *TweetClient) Create() *TweetCreate
- func (c *TweetClient) CreateBulk(builders ...*TweetCreate) *TweetCreateBulk
- func (c *TweetClient) Delete() *TweetDelete
- func (c *TweetClient) DeleteOne(t *Tweet) *TweetDeleteOne
- func (c *TweetClient) DeleteOneID(id int) *TweetDeleteOne
- func (c *TweetClient) Get(ctx context.Context, id int) (*Tweet, error)
- func (c *TweetClient) GetX(ctx context.Context, id int) *Tweet
- func (c *TweetClient) Hooks() []Hook
- func (c *TweetClient) Intercept(interceptors ...Interceptor)
- func (c *TweetClient) Interceptors() []Interceptor
- func (c *TweetClient) MapCreateBulk(slice any, setFunc func(*TweetCreate, int)) *TweetCreateBulk
- func (c *TweetClient) Query() *TweetQuery
- func (c *TweetClient) QueryLikedUsers(t *Tweet) *UserQuery
- func (c *TweetClient) QueryLikes(t *Tweet) *LikeQuery
- func (c *TweetClient) Update() *TweetUpdate
- func (c *TweetClient) UpdateOne(t *Tweet) *TweetUpdateOne
- func (c *TweetClient) UpdateOneID(id int) *TweetUpdateOne
- func (c *TweetClient) Use(hooks ...Hook)
- type TweetConnection
- type TweetCreate
- func (tc *TweetCreate) AddLikedUserIDs(ids ...int) *TweetCreate
- func (tc *TweetCreate) AddLikedUsers(u ...*User) *TweetCreate
- func (tc *TweetCreate) Exec(ctx context.Context) error
- func (tc *TweetCreate) ExecX(ctx context.Context)
- func (tc *TweetCreate) Mutation() *TweetMutation
- func (tc *TweetCreate) OnConflict(opts ...sql.ConflictOption) *TweetUpsertOne
- func (tc *TweetCreate) OnConflictColumns(columns ...string) *TweetUpsertOne
- func (tc *TweetCreate) Save(ctx context.Context) (*Tweet, error)
- func (tc *TweetCreate) SaveX(ctx context.Context) *Tweet
- func (tc *TweetCreate) SetText(s string) *TweetCreate
- type TweetCreateBulk
- func (tcb *TweetCreateBulk) Exec(ctx context.Context) error
- func (tcb *TweetCreateBulk) ExecX(ctx context.Context)
- func (tcb *TweetCreateBulk) OnConflict(opts ...sql.ConflictOption) *TweetUpsertBulk
- func (tcb *TweetCreateBulk) OnConflictColumns(columns ...string) *TweetUpsertBulk
- func (tcb *TweetCreateBulk) Save(ctx context.Context) ([]*Tweet, error)
- func (tcb *TweetCreateBulk) SaveX(ctx context.Context) []*Tweet
- type TweetDelete
- type TweetDeleteOne
- type TweetEdge
- type TweetEdges
- type TweetFilter
- func (f *TweetFilter) Where(p entql.P)
- func (f *TweetFilter) WhereHasLikedUsers()
- func (f *TweetFilter) WhereHasLikedUsersWith(preds ...predicate.User)
- func (f *TweetFilter) WhereHasLikes()
- func (f *TweetFilter) WhereHasLikesWith(preds ...predicate.Like)
- func (f *TweetFilter) WhereID(p entql.IntP)
- func (f *TweetFilter) WhereText(p entql.StringP)
- type TweetGroupBy
- func (tgb *TweetGroupBy) Aggregate(fns ...AggregateFunc) *TweetGroupBy
- func (s *TweetGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *TweetGroupBy) BoolX(ctx context.Context) bool
- func (s *TweetGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *TweetGroupBy) BoolsX(ctx context.Context) []bool
- func (s *TweetGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *TweetGroupBy) Float64X(ctx context.Context) float64
- func (s *TweetGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *TweetGroupBy) Float64sX(ctx context.Context) []float64
- func (s *TweetGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *TweetGroupBy) IntX(ctx context.Context) int
- func (s *TweetGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *TweetGroupBy) IntsX(ctx context.Context) []int
- func (tgb *TweetGroupBy) Scan(ctx context.Context, v any) error
- func (s *TweetGroupBy) ScanX(ctx context.Context, v any)
- func (s *TweetGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *TweetGroupBy) StringX(ctx context.Context) string
- func (s *TweetGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *TweetGroupBy) StringsX(ctx context.Context) []string
- type TweetMutation
- func (m *TweetMutation) AddField(name string, value ent.Value) error
- func (m *TweetMutation) AddLikedUserIDs(ids ...int)
- func (m *TweetMutation) AddedEdges() []string
- func (m *TweetMutation) AddedField(name string) (ent.Value, bool)
- func (m *TweetMutation) AddedFields() []string
- func (m *TweetMutation) AddedIDs(name string) []ent.Value
- func (m *TweetMutation) ClearEdge(name string) error
- func (m *TweetMutation) ClearField(name string) error
- func (m *TweetMutation) ClearLikedUsers()
- func (m *TweetMutation) ClearedEdges() []string
- func (m *TweetMutation) ClearedFields() []string
- func (m TweetMutation) Client() *Client
- func (m *TweetMutation) EdgeCleared(name string) bool
- func (m *TweetMutation) Field(name string) (ent.Value, bool)
- func (m *TweetMutation) FieldCleared(name string) bool
- func (m *TweetMutation) Fields() []string
- func (m *TweetMutation) Filter() *TweetFilter
- func (m *TweetMutation) ID() (id int, exists bool)
- func (m *TweetMutation) IDs(ctx context.Context) ([]int, error)
- func (m *TweetMutation) LikedUsersCleared() bool
- func (m *TweetMutation) LikedUsersIDs() (ids []int)
- func (m *TweetMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *TweetMutation) OldText(ctx context.Context) (v string, err error)
- func (m *TweetMutation) Op() Op
- func (m *TweetMutation) RemoveLikedUserIDs(ids ...int)
- func (m *TweetMutation) RemovedEdges() []string
- func (m *TweetMutation) RemovedIDs(name string) []ent.Value
- func (m *TweetMutation) RemovedLikedUsersIDs() (ids []int)
- func (m *TweetMutation) ResetEdge(name string) error
- func (m *TweetMutation) ResetField(name string) error
- func (m *TweetMutation) ResetLikedUsers()
- func (m *TweetMutation) ResetText()
- func (m *TweetMutation) SetField(name string, value ent.Value) error
- func (m *TweetMutation) SetOp(op Op)
- func (m *TweetMutation) SetText(s string)
- func (m *TweetMutation) Text() (r string, exists bool)
- func (m TweetMutation) Tx() (*Tx, error)
- func (m *TweetMutation) Type() string
- func (m *TweetMutation) Where(ps ...predicate.Tweet)
- func (m *TweetMutation) WhereP(ps ...func(*sql.Selector))
- type TweetOrder
- type TweetOrderField
- type TweetPaginateOption
- type TweetQuery
- func (tq *TweetQuery) Aggregate(fns ...AggregateFunc) *TweetSelect
- func (tq *TweetQuery) All(ctx context.Context) ([]*Tweet, error)
- func (tq *TweetQuery) AllX(ctx context.Context) []*Tweet
- func (tq *TweetQuery) Clone() *TweetQuery
- func (t *TweetQuery) CollectFields(ctx context.Context, satisfies ...string) (*TweetQuery, error)
- func (tq *TweetQuery) Count(ctx context.Context) (int, error)
- func (tq *TweetQuery) CountX(ctx context.Context) int
- func (tq *TweetQuery) Exist(ctx context.Context) (bool, error)
- func (tq *TweetQuery) ExistX(ctx context.Context) bool
- func (tq *TweetQuery) Filter() *TweetFilter
- func (tq *TweetQuery) First(ctx context.Context) (*Tweet, error)
- func (tq *TweetQuery) FirstID(ctx context.Context) (id int, err error)
- func (tq *TweetQuery) FirstIDX(ctx context.Context) int
- func (tq *TweetQuery) FirstX(ctx context.Context) *Tweet
- func (tq *TweetQuery) GroupBy(field string, fields ...string) *TweetGroupBy
- func (tq *TweetQuery) IDs(ctx context.Context) (ids []int, err error)
- func (tq *TweetQuery) IDsX(ctx context.Context) []int
- func (tq *TweetQuery) Limit(limit int) *TweetQuery
- func (tq *TweetQuery) Offset(offset int) *TweetQuery
- func (tq *TweetQuery) Only(ctx context.Context) (*Tweet, error)
- func (tq *TweetQuery) OnlyID(ctx context.Context) (id int, err error)
- func (tq *TweetQuery) OnlyIDX(ctx context.Context) int
- func (tq *TweetQuery) OnlyX(ctx context.Context) *Tweet
- func (tq *TweetQuery) Order(o ...tweet.OrderOption) *TweetQuery
- func (t *TweetQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, ...) (*TweetConnection, error)
- func (tq *TweetQuery) QueryLikedUsers() *UserQuery
- func (tq *TweetQuery) QueryLikes() *LikeQuery
- func (tq *TweetQuery) Select(fields ...string) *TweetSelect
- func (tq *TweetQuery) Unique(unique bool) *TweetQuery
- func (tq *TweetQuery) Where(ps ...predicate.Tweet) *TweetQuery
- func (tq *TweetQuery) WithLikedUsers(opts ...func(*UserQuery)) *TweetQuery
- func (tq *TweetQuery) WithLikes(opts ...func(*LikeQuery)) *TweetQuery
- func (tq *TweetQuery) WithNamedLikedUsers(name string, opts ...func(*UserQuery)) *TweetQuery
- func (tq *TweetQuery) WithNamedLikes(name string, opts ...func(*LikeQuery)) *TweetQuery
- type TweetSelect
- func (ts *TweetSelect) Aggregate(fns ...AggregateFunc) *TweetSelect
- func (s *TweetSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *TweetSelect) BoolX(ctx context.Context) bool
- func (s *TweetSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *TweetSelect) BoolsX(ctx context.Context) []bool
- func (s *TweetSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *TweetSelect) Float64X(ctx context.Context) float64
- func (s *TweetSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *TweetSelect) Float64sX(ctx context.Context) []float64
- func (s *TweetSelect) Int(ctx context.Context) (_ int, err error)
- func (s *TweetSelect) IntX(ctx context.Context) int
- func (s *TweetSelect) Ints(ctx context.Context) ([]int, error)
- func (s *TweetSelect) IntsX(ctx context.Context) []int
- func (ts *TweetSelect) Scan(ctx context.Context, v any) error
- func (s *TweetSelect) ScanX(ctx context.Context, v any)
- func (s *TweetSelect) String(ctx context.Context) (_ string, err error)
- func (s *TweetSelect) StringX(ctx context.Context) string
- func (s *TweetSelect) Strings(ctx context.Context) ([]string, error)
- func (s *TweetSelect) StringsX(ctx context.Context) []string
- type TweetUpdate
- func (tu *TweetUpdate) AddLikedUserIDs(ids ...int) *TweetUpdate
- func (tu *TweetUpdate) AddLikedUsers(u ...*User) *TweetUpdate
- func (tu *TweetUpdate) ClearLikedUsers() *TweetUpdate
- func (tu *TweetUpdate) Exec(ctx context.Context) error
- func (tu *TweetUpdate) ExecX(ctx context.Context)
- func (tu *TweetUpdate) Mutation() *TweetMutation
- func (tu *TweetUpdate) RemoveLikedUserIDs(ids ...int) *TweetUpdate
- func (tu *TweetUpdate) RemoveLikedUsers(u ...*User) *TweetUpdate
- func (tu *TweetUpdate) Save(ctx context.Context) (int, error)
- func (tu *TweetUpdate) SaveX(ctx context.Context) int
- func (tu *TweetUpdate) SetNillableText(s *string) *TweetUpdate
- func (tu *TweetUpdate) SetText(s string) *TweetUpdate
- func (tu *TweetUpdate) Where(ps ...predicate.Tweet) *TweetUpdate
- type TweetUpdateOne
- func (tuo *TweetUpdateOne) AddLikedUserIDs(ids ...int) *TweetUpdateOne
- func (tuo *TweetUpdateOne) AddLikedUsers(u ...*User) *TweetUpdateOne
- func (tuo *TweetUpdateOne) ClearLikedUsers() *TweetUpdateOne
- func (tuo *TweetUpdateOne) Exec(ctx context.Context) error
- func (tuo *TweetUpdateOne) ExecX(ctx context.Context)
- func (tuo *TweetUpdateOne) Mutation() *TweetMutation
- func (tuo *TweetUpdateOne) RemoveLikedUserIDs(ids ...int) *TweetUpdateOne
- func (tuo *TweetUpdateOne) RemoveLikedUsers(u ...*User) *TweetUpdateOne
- func (tuo *TweetUpdateOne) Save(ctx context.Context) (*Tweet, error)
- func (tuo *TweetUpdateOne) SaveX(ctx context.Context) *Tweet
- func (tuo *TweetUpdateOne) Select(field string, fields ...string) *TweetUpdateOne
- func (tuo *TweetUpdateOne) SetNillableText(s *string) *TweetUpdateOne
- func (tuo *TweetUpdateOne) SetText(s string) *TweetUpdateOne
- func (tuo *TweetUpdateOne) Where(ps ...predicate.Tweet) *TweetUpdateOne
- type TweetUpsert
- type TweetUpsertBulk
- func (u *TweetUpsertBulk) DoNothing() *TweetUpsertBulk
- func (u *TweetUpsertBulk) Exec(ctx context.Context) error
- func (u *TweetUpsertBulk) ExecX(ctx context.Context)
- func (u *TweetUpsertBulk) Ignore() *TweetUpsertBulk
- func (u *TweetUpsertBulk) SetText(v string) *TweetUpsertBulk
- func (u *TweetUpsertBulk) Update(set func(*TweetUpsert)) *TweetUpsertBulk
- func (u *TweetUpsertBulk) UpdateNewValues() *TweetUpsertBulk
- func (u *TweetUpsertBulk) UpdateText() *TweetUpsertBulk
- type TweetUpsertOne
- func (u *TweetUpsertOne) DoNothing() *TweetUpsertOne
- func (u *TweetUpsertOne) Exec(ctx context.Context) error
- func (u *TweetUpsertOne) ExecX(ctx context.Context)
- func (u *TweetUpsertOne) ID(ctx context.Context) (id int, err error)
- func (u *TweetUpsertOne) IDX(ctx context.Context) int
- func (u *TweetUpsertOne) Ignore() *TweetUpsertOne
- func (u *TweetUpsertOne) SetText(v string) *TweetUpsertOne
- func (u *TweetUpsertOne) Update(set func(*TweetUpsert)) *TweetUpsertOne
- func (u *TweetUpsertOne) UpdateNewValues() *TweetUpsertOne
- func (u *TweetUpsertOne) UpdateText() *TweetUpsertOne
- type TweetWhereInput
- type Tweets
- type Tx
- type User
- func (n *User) IsNode()
- func (u *User) LikedTweets(ctx context.Context) (result []*Tweet, err error)
- func (u *User) NamedLikedTweets(name string) ([]*Tweet, error)
- func (u *User) QueryLikedTweets() *TweetQuery
- func (u *User) String() string
- func (u *User) ToEdge(order *UserOrder) *UserEdge
- func (u *User) Unwrap() *User
- func (u *User) Update() *UserUpdateOne
- func (u *User) Value(name string) (ent.Value, error)
- type UserClient
- func (c *UserClient) Create() *UserCreate
- func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk
- func (c *UserClient) Delete() *UserDelete
- func (c *UserClient) DeleteOne(u *User) *UserDeleteOne
- func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
- func (c *UserClient) Get(ctx context.Context, id int) (*User, error)
- func (c *UserClient) GetX(ctx context.Context, id int) *User
- func (c *UserClient) Hooks() []Hook
- func (c *UserClient) Intercept(interceptors ...Interceptor)
- func (c *UserClient) Interceptors() []Interceptor
- func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk
- func (c *UserClient) Query() *UserQuery
- func (c *UserClient) QueryLikedTweets(u *User) *TweetQuery
- func (c *UserClient) Update() *UserUpdate
- func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
- func (c *UserClient) UpdateOneID(id int) *UserUpdateOne
- func (c *UserClient) Use(hooks ...Hook)
- type UserConnection
- type UserCreate
- func (uc *UserCreate) AddLikedTweetIDs(ids ...int) *UserCreate
- func (uc *UserCreate) AddLikedTweets(t ...*Tweet) *UserCreate
- func (uc *UserCreate) Exec(ctx context.Context) error
- func (uc *UserCreate) ExecX(ctx context.Context)
- func (uc *UserCreate) Mutation() *UserMutation
- func (uc *UserCreate) OnConflict(opts ...sql.ConflictOption) *UserUpsertOne
- func (uc *UserCreate) OnConflictColumns(columns ...string) *UserUpsertOne
- func (uc *UserCreate) Save(ctx context.Context) (*User, error)
- func (uc *UserCreate) SaveX(ctx context.Context) *User
- func (uc *UserCreate) SetAge(i int) *UserCreate
- func (uc *UserCreate) SetName(s string) *UserCreate
- type UserCreateBulk
- func (ucb *UserCreateBulk) Exec(ctx context.Context) error
- func (ucb *UserCreateBulk) ExecX(ctx context.Context)
- func (ucb *UserCreateBulk) OnConflict(opts ...sql.ConflictOption) *UserUpsertBulk
- func (ucb *UserCreateBulk) OnConflictColumns(columns ...string) *UserUpsertBulk
- func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)
- func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User
- type UserDelete
- type UserDeleteOne
- type UserEdge
- type UserEdges
- type UserFilter
- type UserGroupBy
- func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy
- func (s *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *UserGroupBy) BoolX(ctx context.Context) bool
- func (s *UserGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *UserGroupBy) BoolsX(ctx context.Context) []bool
- func (s *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *UserGroupBy) Float64X(ctx context.Context) float64
- func (s *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *UserGroupBy) Float64sX(ctx context.Context) []float64
- func (s *UserGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *UserGroupBy) IntX(ctx context.Context) int
- func (s *UserGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *UserGroupBy) IntsX(ctx context.Context) []int
- func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error
- func (s *UserGroupBy) ScanX(ctx context.Context, v any)
- func (s *UserGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *UserGroupBy) StringX(ctx context.Context) string
- func (s *UserGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *UserGroupBy) StringsX(ctx context.Context) []string
- type UserMutation
- func (m *UserMutation) AddAge(i int)
- func (m *UserMutation) AddField(name string, value ent.Value) error
- func (m *UserMutation) AddLikedTweetIDs(ids ...int)
- func (m *UserMutation) AddedAge() (r int, exists bool)
- func (m *UserMutation) AddedEdges() []string
- func (m *UserMutation) AddedField(name string) (ent.Value, bool)
- func (m *UserMutation) AddedFields() []string
- func (m *UserMutation) AddedIDs(name string) []ent.Value
- func (m *UserMutation) Age() (r int, exists bool)
- func (m *UserMutation) ClearEdge(name string) error
- func (m *UserMutation) ClearField(name string) error
- func (m *UserMutation) ClearLikedTweets()
- func (m *UserMutation) ClearedEdges() []string
- func (m *UserMutation) ClearedFields() []string
- func (m UserMutation) Client() *Client
- func (m *UserMutation) EdgeCleared(name string) bool
- func (m *UserMutation) Field(name string) (ent.Value, bool)
- func (m *UserMutation) FieldCleared(name string) bool
- func (m *UserMutation) Fields() []string
- func (m *UserMutation) Filter() *UserFilter
- func (m *UserMutation) ID() (id int, exists bool)
- func (m *UserMutation) IDs(ctx context.Context) ([]int, error)
- func (m *UserMutation) LikedTweetsCleared() bool
- func (m *UserMutation) LikedTweetsIDs() (ids []int)
- func (m *UserMutation) Name() (r string, exists bool)
- func (m *UserMutation) OldAge(ctx context.Context) (v int, err error)
- func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *UserMutation) OldName(ctx context.Context) (v string, err error)
- func (m *UserMutation) Op() Op
- func (m *UserMutation) RemoveLikedTweetIDs(ids ...int)
- func (m *UserMutation) RemovedEdges() []string
- func (m *UserMutation) RemovedIDs(name string) []ent.Value
- func (m *UserMutation) RemovedLikedTweetsIDs() (ids []int)
- func (m *UserMutation) ResetAge()
- func (m *UserMutation) ResetEdge(name string) error
- func (m *UserMutation) ResetField(name string) error
- func (m *UserMutation) ResetLikedTweets()
- func (m *UserMutation) ResetName()
- func (m *UserMutation) SetAge(i int)
- func (m *UserMutation) SetField(name string, value ent.Value) error
- func (m *UserMutation) SetName(s string)
- func (m *UserMutation) SetOp(op Op)
- func (m UserMutation) Tx() (*Tx, error)
- func (m *UserMutation) Type() string
- func (m *UserMutation) Where(ps ...predicate.User)
- func (m *UserMutation) WhereP(ps ...func(*sql.Selector))
- type UserOrder
- type UserOrderField
- type UserPaginateOption
- type UserQuery
- func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect
- func (uq *UserQuery) All(ctx context.Context) ([]*User, error)
- func (uq *UserQuery) AllX(ctx context.Context) []*User
- func (uq *UserQuery) Clone() *UserQuery
- func (u *UserQuery) CollectFields(ctx context.Context, satisfies ...string) (*UserQuery, error)
- func (uq *UserQuery) Count(ctx context.Context) (int, error)
- func (uq *UserQuery) CountX(ctx context.Context) int
- func (uq *UserQuery) Exist(ctx context.Context) (bool, error)
- func (uq *UserQuery) ExistX(ctx context.Context) bool
- func (uq *UserQuery) Filter() *UserFilter
- func (uq *UserQuery) First(ctx context.Context) (*User, error)
- func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)
- func (uq *UserQuery) FirstIDX(ctx context.Context) int
- func (uq *UserQuery) FirstX(ctx context.Context) *User
- func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy
- func (uq *UserQuery) IDs(ctx context.Context) (ids []int, err error)
- func (uq *UserQuery) IDsX(ctx context.Context) []int
- func (uq *UserQuery) Limit(limit int) *UserQuery
- func (uq *UserQuery) Offset(offset int) *UserQuery
- func (uq *UserQuery) Only(ctx context.Context) (*User, error)
- func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)
- func (uq *UserQuery) OnlyIDX(ctx context.Context) int
- func (uq *UserQuery) OnlyX(ctx context.Context) *User
- func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery
- func (u *UserQuery) Paginate(ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, ...) (*UserConnection, error)
- func (uq *UserQuery) QueryLikedTweets() *TweetQuery
- func (uq *UserQuery) Select(fields ...string) *UserSelect
- func (uq *UserQuery) Unique(unique bool) *UserQuery
- func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery
- func (uq *UserQuery) WithLikedTweets(opts ...func(*TweetQuery)) *UserQuery
- func (uq *UserQuery) WithNamedLikedTweets(name string, opts ...func(*TweetQuery)) *UserQuery
- type UserSelect
- func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect
- func (s *UserSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *UserSelect) BoolX(ctx context.Context) bool
- func (s *UserSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *UserSelect) BoolsX(ctx context.Context) []bool
- func (s *UserSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *UserSelect) Float64X(ctx context.Context) float64
- func (s *UserSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *UserSelect) Float64sX(ctx context.Context) []float64
- func (s *UserSelect) Int(ctx context.Context) (_ int, err error)
- func (s *UserSelect) IntX(ctx context.Context) int
- func (s *UserSelect) Ints(ctx context.Context) ([]int, error)
- func (s *UserSelect) IntsX(ctx context.Context) []int
- func (us *UserSelect) Scan(ctx context.Context, v any) error
- func (s *UserSelect) ScanX(ctx context.Context, v any)
- func (s *UserSelect) String(ctx context.Context) (_ string, err error)
- func (s *UserSelect) StringX(ctx context.Context) string
- func (s *UserSelect) Strings(ctx context.Context) ([]string, error)
- func (s *UserSelect) StringsX(ctx context.Context) []string
- type UserUpdate
- func (uu *UserUpdate) AddAge(i int) *UserUpdate
- func (uu *UserUpdate) AddLikedTweetIDs(ids ...int) *UserUpdate
- func (uu *UserUpdate) AddLikedTweets(t ...*Tweet) *UserUpdate
- func (uu *UserUpdate) ClearLikedTweets() *UserUpdate
- func (uu *UserUpdate) Exec(ctx context.Context) error
- func (uu *UserUpdate) ExecX(ctx context.Context)
- func (uu *UserUpdate) Mutation() *UserMutation
- func (uu *UserUpdate) RemoveLikedTweetIDs(ids ...int) *UserUpdate
- func (uu *UserUpdate) RemoveLikedTweets(t ...*Tweet) *UserUpdate
- func (uu *UserUpdate) Save(ctx context.Context) (int, error)
- func (uu *UserUpdate) SaveX(ctx context.Context) int
- func (uu *UserUpdate) SetAge(i int) *UserUpdate
- func (uu *UserUpdate) SetName(s string) *UserUpdate
- func (uu *UserUpdate) SetNillableAge(i *int) *UserUpdate
- func (uu *UserUpdate) SetNillableName(s *string) *UserUpdate
- func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
- type UserUpdateOne
- func (uuo *UserUpdateOne) AddAge(i int) *UserUpdateOne
- func (uuo *UserUpdateOne) AddLikedTweetIDs(ids ...int) *UserUpdateOne
- func (uuo *UserUpdateOne) AddLikedTweets(t ...*Tweet) *UserUpdateOne
- func (uuo *UserUpdateOne) ClearLikedTweets() *UserUpdateOne
- func (uuo *UserUpdateOne) Exec(ctx context.Context) error
- func (uuo *UserUpdateOne) ExecX(ctx context.Context)
- func (uuo *UserUpdateOne) Mutation() *UserMutation
- func (uuo *UserUpdateOne) RemoveLikedTweetIDs(ids ...int) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveLikedTweets(t ...*Tweet) *UserUpdateOne
- func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)
- func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User
- func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetAge(i int) *UserUpdateOne
- func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) SetNillableAge(i *int) *UserUpdateOne
- func (uuo *UserUpdateOne) SetNillableName(s *string) *UserUpdateOne
- func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne
- type UserUpsert
- type UserUpsertBulk
- func (u *UserUpsertBulk) AddAge(v int) *UserUpsertBulk
- func (u *UserUpsertBulk) DoNothing() *UserUpsertBulk
- func (u *UserUpsertBulk) Exec(ctx context.Context) error
- func (u *UserUpsertBulk) ExecX(ctx context.Context)
- func (u *UserUpsertBulk) Ignore() *UserUpsertBulk
- func (u *UserUpsertBulk) SetAge(v int) *UserUpsertBulk
- func (u *UserUpsertBulk) SetName(v string) *UserUpsertBulk
- func (u *UserUpsertBulk) Update(set func(*UserUpsert)) *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateAge() *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateName() *UserUpsertBulk
- func (u *UserUpsertBulk) UpdateNewValues() *UserUpsertBulk
- type UserUpsertOne
- func (u *UserUpsertOne) AddAge(v int) *UserUpsertOne
- func (u *UserUpsertOne) DoNothing() *UserUpsertOne
- func (u *UserUpsertOne) Exec(ctx context.Context) error
- func (u *UserUpsertOne) ExecX(ctx context.Context)
- func (u *UserUpsertOne) ID(ctx context.Context) (id int, err error)
- func (u *UserUpsertOne) IDX(ctx context.Context) int
- func (u *UserUpsertOne) Ignore() *UserUpsertOne
- func (u *UserUpsertOne) SetAge(v int) *UserUpsertOne
- func (u *UserUpsertOne) SetName(v string) *UserUpsertOne
- func (u *UserUpsertOne) Update(set func(*UserUpsert)) *UserUpsertOne
- func (u *UserUpsertOne) UpdateAge() *UserUpsertOne
- func (u *UserUpsertOne) UpdateName() *UserUpsertOne
- func (u *UserUpsertOne) UpdateNewValues() *UserUpsertOne
- type UserWhereInput
- type Users
- type ValidationError
- type Value
Constants ¶
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 ¶
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, } }, } )
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.
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.
var ErrEmptyTweetWhereInput = errors.New("ent: empty predicate TweetWhereInput")
ErrEmptyTweetWhereInput is returned in case the TweetWhereInput is empty.
var ErrEmptyUserWhereInput = errors.New("ent: empty predicate UserWhereInput")
ErrEmptyUserWhereInput is returned in case the UserWhereInput is empty.
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 IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
func NewTxContext ¶
NewTxContext returns a new context with the given Tx attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
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 ¶
FromContext returns a Client stored inside a context, or nil if there isn't one.
func Open ¶
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) Debug ¶
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) Noder ¶
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) OpenTx ¶
OpenTx opens a transaction and returns a transactional context along with the created transaction.
type CommitFunc ¶
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.
type CommitHook ¶
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 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 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) Unwrap ¶
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.
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) 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)
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 ¶
TweetOrErr returns the Tweet 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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*LikeGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*LikeGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*LikeGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*LikeGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*LikeGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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 ¶
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) 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) Clone ¶
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) Filter ¶
func (lq *LikeQuery) Filter() *LikeFilter
Filter returns a Filter implementation to apply filters on the LikeQuery builder.
func (*LikeQuery) First ¶
First returns the first Like entity from the query. Returns a *NotFoundError when no Like was found.
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) Only ¶
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) 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) 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 ¶
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) 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.
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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*LikeSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*LikeSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*LikeSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*LikeSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*LikeSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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 ¶
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 MutateFunc ¶
type MutateFunc = ent.MutateFunc
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 ¶
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 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 OrderFunc ¶
OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.
type QuerierFunc ¶
type QuerierFunc = ent.QuerierFunc
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 ¶
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.
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 ¶
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 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 (*Tweet) NamedLikedUsers ¶
NamedLikedUsers returns the LikedUsers named value or an error if the edge was not loaded in eager-loading with this name.
func (*Tweet) NamedLikes ¶
NamedLikes returns the Likes named value or an error if the edge was not loaded in eager-loading with this name.
func (*Tweet) QueryLikedUsers ¶
QueryLikedUsers queries the "liked_users" edge of the Tweet entity.
func (*Tweet) QueryLikes ¶
QueryLikes queries the "likes" edge of the Tweet entity.
func (*Tweet) ToEdge ¶
func (t *Tweet) ToEdge(order *TweetOrder) *TweetEdge
ToEdge converts Tweet into TweetEdge.
func (*Tweet) Unwrap ¶
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.
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) GetX ¶
func (c *TweetClient) GetX(ctx context.Context, id int) *Tweet
GetX is like Get, but panics if an error occurs.
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)
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 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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*TweetGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*TweetGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*TweetGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*TweetGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*TweetGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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 ¶
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) 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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*TweetSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*TweetSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*TweetSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*TweetSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*TweetSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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 ¶
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.
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 ¶
TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func (*Tx) OnRollback ¶
func (tx *Tx) OnRollback(f RollbackHook)
OnRollback adds a hook to call on rollback.
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 (*User) NamedLikedTweets ¶
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) Unwrap ¶
Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.
func (*User) Update ¶
func (u *User) Update() *UserUpdateOne
Update returns a builder for updating this User. Note that you need to call User.Unwrap() before calling this method if this User was returned from a transaction, and the transaction was committed or rolled back.
type UserClient ¶
type UserClient struct {
// contains filtered or unexported fields
}
UserClient is a client for the User schema.
func NewUserClient ¶
func NewUserClient(c config) *UserClient
NewUserClient returns a client for the User from the given config.
func (*UserClient) Create ¶
func (c *UserClient) Create() *UserCreate
Create returns a builder for creating a User entity.
func (*UserClient) CreateBulk ¶
func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk
CreateBulk returns a builder for creating a bulk of User entities.
func (*UserClient) Delete ¶
func (c *UserClient) Delete() *UserDelete
Delete returns a delete builder for User.
func (*UserClient) DeleteOne ¶
func (c *UserClient) DeleteOne(u *User) *UserDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*UserClient) DeleteOneID ¶
func (c *UserClient) DeleteOneID(id int) *UserDeleteOne
DeleteOneID returns a builder for deleting the given 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) 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)
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 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 ¶
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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*UserGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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 ¶
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) 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) 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) Clone ¶
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 ¶
CollectFields tells the query-builder to eagerly load connected nodes by resolver context.
func (*UserQuery) Filter ¶
func (uq *UserQuery) Filter() *UserFilter
Filter returns a Filter implementation to apply filters on the UserQuery builder.
func (*UserQuery) First ¶
First returns the first User entity from the query. Returns a *NotFoundError when no User was found.
func (*UserQuery) FirstID ¶
FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.
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) Only ¶
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 ¶
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) 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 ¶
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) 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 ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*UserSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*UserSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*UserSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*UserSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*UserSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
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) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
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 ¶
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.
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.
Source Files ¶
- client.go
- ent.go
- entql.go
- gql_collection.go
- gql_edge.go
- gql_mutation_input.go
- gql_node.go
- gql_pagination.go
- gql_transaction.go
- gql_where_input.go
- like.go
- like_create.go
- like_delete.go
- like_query.go
- like_update.go
- mutation.go
- runtime.go
- tweet.go
- tweet_create.go
- tweet_delete.go
- tweet_query.go
- tweet_update.go
- tx.go
- user.go
- user_create.go
- user_delete.go
- user_query.go
- user_update.go