Documentation
¶
Index ¶
- Constants
- 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
- 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) Tx(ctx context.Context) (*Tx, error)
- func (c *Client) Use(hooks ...Hook)
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type InterceptFunc
- type Interceptor
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Querier
- type QuerierFunc
- type Query
- type QueryContext
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Sentence
- type SentenceClient
- func (c *SentenceClient) Create() *SentenceCreate
- func (c *SentenceClient) CreateBulk(builders ...*SentenceCreate) *SentenceCreateBulk
- func (c *SentenceClient) Delete() *SentenceDelete
- func (c *SentenceClient) DeleteOne(s *Sentence) *SentenceDeleteOne
- func (c *SentenceClient) DeleteOneID(id uuid.UUID) *SentenceDeleteOne
- func (c *SentenceClient) Get(ctx context.Context, id uuid.UUID) (*Sentence, error)
- func (c *SentenceClient) GetX(ctx context.Context, id uuid.UUID) *Sentence
- func (c *SentenceClient) Hooks() []Hook
- func (c *SentenceClient) Intercept(interceptors ...Interceptor)
- func (c *SentenceClient) Interceptors() []Interceptor
- func (c *SentenceClient) Query() *SentenceQuery
- func (c *SentenceClient) QueryAuthor(s *Sentence) *UserQuery
- func (c *SentenceClient) QueryStory(s *Sentence) *StoryQuery
- func (c *SentenceClient) Update() *SentenceUpdate
- func (c *SentenceClient) UpdateOne(s *Sentence) *SentenceUpdateOne
- func (c *SentenceClient) UpdateOneID(id uuid.UUID) *SentenceUpdateOne
- func (c *SentenceClient) Use(hooks ...Hook)
- type SentenceCreate
- func (sc *SentenceCreate) AddAuthor(u ...*User) *SentenceCreate
- func (sc *SentenceCreate) AddAuthorIDs(ids ...uuid.UUID) *SentenceCreate
- func (sc *SentenceCreate) Exec(ctx context.Context) error
- func (sc *SentenceCreate) ExecX(ctx context.Context)
- func (sc *SentenceCreate) Mutation() *SentenceMutation
- func (sc *SentenceCreate) Save(ctx context.Context) (*Sentence, error)
- func (sc *SentenceCreate) SaveX(ctx context.Context) *Sentence
- func (sc *SentenceCreate) SetCreatedAt(t time.Time) *SentenceCreate
- func (sc *SentenceCreate) SetID(u uuid.UUID) *SentenceCreate
- func (sc *SentenceCreate) SetNillableCreatedAt(t *time.Time) *SentenceCreate
- func (sc *SentenceCreate) SetNillableID(u *uuid.UUID) *SentenceCreate
- func (sc *SentenceCreate) SetOrder(i int) *SentenceCreate
- func (sc *SentenceCreate) SetStory(s *Story) *SentenceCreate
- func (sc *SentenceCreate) SetStoryID(id uuid.UUID) *SentenceCreate
- func (sc *SentenceCreate) SetText(s string) *SentenceCreate
- type SentenceCreateBulk
- type SentenceDelete
- type SentenceDeleteOne
- type SentenceEdges
- type SentenceGroupBy
- func (sgb *SentenceGroupBy) Aggregate(fns ...AggregateFunc) *SentenceGroupBy
- func (s *SentenceGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *SentenceGroupBy) BoolX(ctx context.Context) bool
- func (s *SentenceGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *SentenceGroupBy) BoolsX(ctx context.Context) []bool
- func (s *SentenceGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *SentenceGroupBy) Float64X(ctx context.Context) float64
- func (s *SentenceGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *SentenceGroupBy) Float64sX(ctx context.Context) []float64
- func (s *SentenceGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *SentenceGroupBy) IntX(ctx context.Context) int
- func (s *SentenceGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *SentenceGroupBy) IntsX(ctx context.Context) []int
- func (sgb *SentenceGroupBy) Scan(ctx context.Context, v any) error
- func (s *SentenceGroupBy) ScanX(ctx context.Context, v any)
- func (s *SentenceGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *SentenceGroupBy) StringX(ctx context.Context) string
- func (s *SentenceGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *SentenceGroupBy) StringsX(ctx context.Context) []string
- type SentenceMutation
- func (m *SentenceMutation) AddAuthorIDs(ids ...uuid.UUID)
- func (m *SentenceMutation) AddField(name string, value ent.Value) error
- func (m *SentenceMutation) AddOrder(i int)
- func (m *SentenceMutation) AddedEdges() []string
- func (m *SentenceMutation) AddedField(name string) (ent.Value, bool)
- func (m *SentenceMutation) AddedFields() []string
- func (m *SentenceMutation) AddedIDs(name string) []ent.Value
- func (m *SentenceMutation) AddedOrder() (r int, exists bool)
- func (m *SentenceMutation) AuthorCleared() bool
- func (m *SentenceMutation) AuthorIDs() (ids []uuid.UUID)
- func (m *SentenceMutation) ClearAuthor()
- func (m *SentenceMutation) ClearEdge(name string) error
- func (m *SentenceMutation) ClearField(name string) error
- func (m *SentenceMutation) ClearStory()
- func (m *SentenceMutation) ClearedEdges() []string
- func (m *SentenceMutation) ClearedFields() []string
- func (m SentenceMutation) Client() *Client
- func (m *SentenceMutation) CreatedAt() (r time.Time, exists bool)
- func (m *SentenceMutation) EdgeCleared(name string) bool
- func (m *SentenceMutation) Field(name string) (ent.Value, bool)
- func (m *SentenceMutation) FieldCleared(name string) bool
- func (m *SentenceMutation) Fields() []string
- func (m *SentenceMutation) ID() (id uuid.UUID, exists bool)
- func (m *SentenceMutation) IDs(ctx context.Context) ([]uuid.UUID, error)
- func (m *SentenceMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *SentenceMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *SentenceMutation) OldOrder(ctx context.Context) (v int, err error)
- func (m *SentenceMutation) OldText(ctx context.Context) (v string, err error)
- func (m *SentenceMutation) Op() Op
- func (m *SentenceMutation) Order() (r int, exists bool)
- func (m *SentenceMutation) RemoveAuthorIDs(ids ...uuid.UUID)
- func (m *SentenceMutation) RemovedAuthorIDs() (ids []uuid.UUID)
- func (m *SentenceMutation) RemovedEdges() []string
- func (m *SentenceMutation) RemovedIDs(name string) []ent.Value
- func (m *SentenceMutation) ResetAuthor()
- func (m *SentenceMutation) ResetCreatedAt()
- func (m *SentenceMutation) ResetEdge(name string) error
- func (m *SentenceMutation) ResetField(name string) error
- func (m *SentenceMutation) ResetOrder()
- func (m *SentenceMutation) ResetStory()
- func (m *SentenceMutation) ResetText()
- func (m *SentenceMutation) SetCreatedAt(t time.Time)
- func (m *SentenceMutation) SetField(name string, value ent.Value) error
- func (m *SentenceMutation) SetID(id uuid.UUID)
- func (m *SentenceMutation) SetOp(op Op)
- func (m *SentenceMutation) SetOrder(i int)
- func (m *SentenceMutation) SetStoryID(id uuid.UUID)
- func (m *SentenceMutation) SetText(s string)
- func (m *SentenceMutation) StoryCleared() bool
- func (m *SentenceMutation) StoryID() (id uuid.UUID, exists bool)
- func (m *SentenceMutation) StoryIDs() (ids []uuid.UUID)
- func (m *SentenceMutation) Text() (r string, exists bool)
- func (m SentenceMutation) Tx() (*Tx, error)
- func (m *SentenceMutation) Type() string
- func (m *SentenceMutation) Where(ps ...predicate.Sentence)
- func (m *SentenceMutation) WhereP(ps ...func(*sql.Selector))
- type SentenceQuery
- func (sq *SentenceQuery) Aggregate(fns ...AggregateFunc) *SentenceSelect
- func (sq *SentenceQuery) All(ctx context.Context) ([]*Sentence, error)
- func (sq *SentenceQuery) AllX(ctx context.Context) []*Sentence
- func (sq *SentenceQuery) Clone() *SentenceQuery
- func (sq *SentenceQuery) Count(ctx context.Context) (int, error)
- func (sq *SentenceQuery) CountX(ctx context.Context) int
- func (sq *SentenceQuery) Exist(ctx context.Context) (bool, error)
- func (sq *SentenceQuery) ExistX(ctx context.Context) bool
- func (sq *SentenceQuery) First(ctx context.Context) (*Sentence, error)
- func (sq *SentenceQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)
- func (sq *SentenceQuery) FirstIDX(ctx context.Context) uuid.UUID
- func (sq *SentenceQuery) FirstX(ctx context.Context) *Sentence
- func (sq *SentenceQuery) GroupBy(field string, fields ...string) *SentenceGroupBy
- func (sq *SentenceQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)
- func (sq *SentenceQuery) IDsX(ctx context.Context) []uuid.UUID
- func (sq *SentenceQuery) Limit(limit int) *SentenceQuery
- func (sq *SentenceQuery) Offset(offset int) *SentenceQuery
- func (sq *SentenceQuery) Only(ctx context.Context) (*Sentence, error)
- func (sq *SentenceQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)
- func (sq *SentenceQuery) OnlyIDX(ctx context.Context) uuid.UUID
- func (sq *SentenceQuery) OnlyX(ctx context.Context) *Sentence
- func (sq *SentenceQuery) Order(o ...sentence.OrderOption) *SentenceQuery
- func (sq *SentenceQuery) QueryAuthor() *UserQuery
- func (sq *SentenceQuery) QueryStory() *StoryQuery
- func (sq *SentenceQuery) Select(fields ...string) *SentenceSelect
- func (sq *SentenceQuery) Unique(unique bool) *SentenceQuery
- func (sq *SentenceQuery) Where(ps ...predicate.Sentence) *SentenceQuery
- func (sq *SentenceQuery) WithAuthor(opts ...func(*UserQuery)) *SentenceQuery
- func (sq *SentenceQuery) WithStory(opts ...func(*StoryQuery)) *SentenceQuery
- type SentenceSelect
- func (ss *SentenceSelect) Aggregate(fns ...AggregateFunc) *SentenceSelect
- func (s *SentenceSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *SentenceSelect) BoolX(ctx context.Context) bool
- func (s *SentenceSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *SentenceSelect) BoolsX(ctx context.Context) []bool
- func (s *SentenceSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *SentenceSelect) Float64X(ctx context.Context) float64
- func (s *SentenceSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *SentenceSelect) Float64sX(ctx context.Context) []float64
- func (s *SentenceSelect) Int(ctx context.Context) (_ int, err error)
- func (s *SentenceSelect) IntX(ctx context.Context) int
- func (s *SentenceSelect) Ints(ctx context.Context) ([]int, error)
- func (s *SentenceSelect) IntsX(ctx context.Context) []int
- func (ss *SentenceSelect) Scan(ctx context.Context, v any) error
- func (s *SentenceSelect) ScanX(ctx context.Context, v any)
- func (s *SentenceSelect) String(ctx context.Context) (_ string, err error)
- func (s *SentenceSelect) StringX(ctx context.Context) string
- func (s *SentenceSelect) Strings(ctx context.Context) ([]string, error)
- func (s *SentenceSelect) StringsX(ctx context.Context) []string
- type SentenceUpdate
- func (su *SentenceUpdate) AddAuthor(u ...*User) *SentenceUpdate
- func (su *SentenceUpdate) AddAuthorIDs(ids ...uuid.UUID) *SentenceUpdate
- func (su *SentenceUpdate) AddOrder(i int) *SentenceUpdate
- func (su *SentenceUpdate) ClearAuthor() *SentenceUpdate
- func (su *SentenceUpdate) ClearStory() *SentenceUpdate
- func (su *SentenceUpdate) Exec(ctx context.Context) error
- func (su *SentenceUpdate) ExecX(ctx context.Context)
- func (su *SentenceUpdate) Mutation() *SentenceMutation
- func (su *SentenceUpdate) RemoveAuthor(u ...*User) *SentenceUpdate
- func (su *SentenceUpdate) RemoveAuthorIDs(ids ...uuid.UUID) *SentenceUpdate
- func (su *SentenceUpdate) Save(ctx context.Context) (int, error)
- func (su *SentenceUpdate) SaveX(ctx context.Context) int
- func (su *SentenceUpdate) SetCreatedAt(t time.Time) *SentenceUpdate
- func (su *SentenceUpdate) SetNillableCreatedAt(t *time.Time) *SentenceUpdate
- func (su *SentenceUpdate) SetOrder(i int) *SentenceUpdate
- func (su *SentenceUpdate) SetStory(s *Story) *SentenceUpdate
- func (su *SentenceUpdate) SetStoryID(id uuid.UUID) *SentenceUpdate
- func (su *SentenceUpdate) SetText(s string) *SentenceUpdate
- func (su *SentenceUpdate) Where(ps ...predicate.Sentence) *SentenceUpdate
- type SentenceUpdateOne
- func (suo *SentenceUpdateOne) AddAuthor(u ...*User) *SentenceUpdateOne
- func (suo *SentenceUpdateOne) AddAuthorIDs(ids ...uuid.UUID) *SentenceUpdateOne
- func (suo *SentenceUpdateOne) AddOrder(i int) *SentenceUpdateOne
- func (suo *SentenceUpdateOne) ClearAuthor() *SentenceUpdateOne
- func (suo *SentenceUpdateOne) ClearStory() *SentenceUpdateOne
- func (suo *SentenceUpdateOne) Exec(ctx context.Context) error
- func (suo *SentenceUpdateOne) ExecX(ctx context.Context)
- func (suo *SentenceUpdateOne) Mutation() *SentenceMutation
- func (suo *SentenceUpdateOne) RemoveAuthor(u ...*User) *SentenceUpdateOne
- func (suo *SentenceUpdateOne) RemoveAuthorIDs(ids ...uuid.UUID) *SentenceUpdateOne
- func (suo *SentenceUpdateOne) Save(ctx context.Context) (*Sentence, error)
- func (suo *SentenceUpdateOne) SaveX(ctx context.Context) *Sentence
- func (suo *SentenceUpdateOne) Select(field string, fields ...string) *SentenceUpdateOne
- func (suo *SentenceUpdateOne) SetCreatedAt(t time.Time) *SentenceUpdateOne
- func (suo *SentenceUpdateOne) SetNillableCreatedAt(t *time.Time) *SentenceUpdateOne
- func (suo *SentenceUpdateOne) SetOrder(i int) *SentenceUpdateOne
- func (suo *SentenceUpdateOne) SetStory(s *Story) *SentenceUpdateOne
- func (suo *SentenceUpdateOne) SetStoryID(id uuid.UUID) *SentenceUpdateOne
- func (suo *SentenceUpdateOne) SetText(s string) *SentenceUpdateOne
- func (suo *SentenceUpdateOne) Where(ps ...predicate.Sentence) *SentenceUpdateOne
- type Sentences
- type Stories
- type Story
- type StoryClient
- func (c *StoryClient) Create() *StoryCreate
- func (c *StoryClient) CreateBulk(builders ...*StoryCreate) *StoryCreateBulk
- func (c *StoryClient) Delete() *StoryDelete
- func (c *StoryClient) DeleteOne(s *Story) *StoryDeleteOne
- func (c *StoryClient) DeleteOneID(id uuid.UUID) *StoryDeleteOne
- func (c *StoryClient) Get(ctx context.Context, id uuid.UUID) (*Story, error)
- func (c *StoryClient) GetX(ctx context.Context, id uuid.UUID) *Story
- func (c *StoryClient) Hooks() []Hook
- func (c *StoryClient) Intercept(interceptors ...Interceptor)
- func (c *StoryClient) Interceptors() []Interceptor
- func (c *StoryClient) Query() *StoryQuery
- func (c *StoryClient) QuerySentences(s *Story) *SentenceQuery
- func (c *StoryClient) Update() *StoryUpdate
- func (c *StoryClient) UpdateOne(s *Story) *StoryUpdateOne
- func (c *StoryClient) UpdateOneID(id uuid.UUID) *StoryUpdateOne
- func (c *StoryClient) Use(hooks ...Hook)
- type StoryCreate
- func (sc *StoryCreate) AddSentenceIDs(ids ...uuid.UUID) *StoryCreate
- func (sc *StoryCreate) AddSentences(s ...*Sentence) *StoryCreate
- func (sc *StoryCreate) Exec(ctx context.Context) error
- func (sc *StoryCreate) ExecX(ctx context.Context)
- func (sc *StoryCreate) Mutation() *StoryMutation
- func (sc *StoryCreate) Save(ctx context.Context) (*Story, error)
- func (sc *StoryCreate) SaveX(ctx context.Context) *Story
- func (sc *StoryCreate) SetCreatedAt(t time.Time) *StoryCreate
- func (sc *StoryCreate) SetID(u uuid.UUID) *StoryCreate
- func (sc *StoryCreate) SetNillableCreatedAt(t *time.Time) *StoryCreate
- func (sc *StoryCreate) SetNillableID(u *uuid.UUID) *StoryCreate
- func (sc *StoryCreate) SetNillableStatus(s *story.Status) *StoryCreate
- func (sc *StoryCreate) SetStatus(s story.Status) *StoryCreate
- func (sc *StoryCreate) SetUpdatedAt(t time.Time) *StoryCreate
- type StoryCreateBulk
- type StoryDelete
- type StoryDeleteOne
- type StoryEdges
- type StoryGroupBy
- func (sgb *StoryGroupBy) Aggregate(fns ...AggregateFunc) *StoryGroupBy
- func (s *StoryGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *StoryGroupBy) BoolX(ctx context.Context) bool
- func (s *StoryGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *StoryGroupBy) BoolsX(ctx context.Context) []bool
- func (s *StoryGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *StoryGroupBy) Float64X(ctx context.Context) float64
- func (s *StoryGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *StoryGroupBy) Float64sX(ctx context.Context) []float64
- func (s *StoryGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *StoryGroupBy) IntX(ctx context.Context) int
- func (s *StoryGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *StoryGroupBy) IntsX(ctx context.Context) []int
- func (sgb *StoryGroupBy) Scan(ctx context.Context, v any) error
- func (s *StoryGroupBy) ScanX(ctx context.Context, v any)
- func (s *StoryGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *StoryGroupBy) StringX(ctx context.Context) string
- func (s *StoryGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *StoryGroupBy) StringsX(ctx context.Context) []string
- type StoryMutation
- func (m *StoryMutation) AddField(name string, value ent.Value) error
- func (m *StoryMutation) AddSentenceIDs(ids ...uuid.UUID)
- func (m *StoryMutation) AddedEdges() []string
- func (m *StoryMutation) AddedField(name string) (ent.Value, bool)
- func (m *StoryMutation) AddedFields() []string
- func (m *StoryMutation) AddedIDs(name string) []ent.Value
- func (m *StoryMutation) ClearEdge(name string) error
- func (m *StoryMutation) ClearField(name string) error
- func (m *StoryMutation) ClearSentences()
- func (m *StoryMutation) ClearedEdges() []string
- func (m *StoryMutation) ClearedFields() []string
- func (m StoryMutation) Client() *Client
- func (m *StoryMutation) CreatedAt() (r time.Time, exists bool)
- func (m *StoryMutation) EdgeCleared(name string) bool
- func (m *StoryMutation) Field(name string) (ent.Value, bool)
- func (m *StoryMutation) FieldCleared(name string) bool
- func (m *StoryMutation) Fields() []string
- func (m *StoryMutation) ID() (id uuid.UUID, exists bool)
- func (m *StoryMutation) IDs(ctx context.Context) ([]uuid.UUID, error)
- func (m *StoryMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)
- func (m *StoryMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *StoryMutation) OldStatus(ctx context.Context) (v story.Status, err error)
- func (m *StoryMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)
- func (m *StoryMutation) Op() Op
- func (m *StoryMutation) RemoveSentenceIDs(ids ...uuid.UUID)
- func (m *StoryMutation) RemovedEdges() []string
- func (m *StoryMutation) RemovedIDs(name string) []ent.Value
- func (m *StoryMutation) RemovedSentencesIDs() (ids []uuid.UUID)
- func (m *StoryMutation) ResetCreatedAt()
- func (m *StoryMutation) ResetEdge(name string) error
- func (m *StoryMutation) ResetField(name string) error
- func (m *StoryMutation) ResetSentences()
- func (m *StoryMutation) ResetStatus()
- func (m *StoryMutation) ResetUpdatedAt()
- func (m *StoryMutation) SentencesCleared() bool
- func (m *StoryMutation) SentencesIDs() (ids []uuid.UUID)
- func (m *StoryMutation) SetCreatedAt(t time.Time)
- func (m *StoryMutation) SetField(name string, value ent.Value) error
- func (m *StoryMutation) SetID(id uuid.UUID)
- func (m *StoryMutation) SetOp(op Op)
- func (m *StoryMutation) SetStatus(s story.Status)
- func (m *StoryMutation) SetUpdatedAt(t time.Time)
- func (m *StoryMutation) Status() (r story.Status, exists bool)
- func (m StoryMutation) Tx() (*Tx, error)
- func (m *StoryMutation) Type() string
- func (m *StoryMutation) UpdatedAt() (r time.Time, exists bool)
- func (m *StoryMutation) Where(ps ...predicate.Story)
- func (m *StoryMutation) WhereP(ps ...func(*sql.Selector))
- type StoryQuery
- func (sq *StoryQuery) Aggregate(fns ...AggregateFunc) *StorySelect
- func (sq *StoryQuery) All(ctx context.Context) ([]*Story, error)
- func (sq *StoryQuery) AllX(ctx context.Context) []*Story
- func (sq *StoryQuery) Clone() *StoryQuery
- func (sq *StoryQuery) Count(ctx context.Context) (int, error)
- func (sq *StoryQuery) CountX(ctx context.Context) int
- func (sq *StoryQuery) Exist(ctx context.Context) (bool, error)
- func (sq *StoryQuery) ExistX(ctx context.Context) bool
- func (sq *StoryQuery) First(ctx context.Context) (*Story, error)
- func (sq *StoryQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)
- func (sq *StoryQuery) FirstIDX(ctx context.Context) uuid.UUID
- func (sq *StoryQuery) FirstX(ctx context.Context) *Story
- func (sq *StoryQuery) GroupBy(field string, fields ...string) *StoryGroupBy
- func (sq *StoryQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)
- func (sq *StoryQuery) IDsX(ctx context.Context) []uuid.UUID
- func (sq *StoryQuery) Limit(limit int) *StoryQuery
- func (sq *StoryQuery) Offset(offset int) *StoryQuery
- func (sq *StoryQuery) Only(ctx context.Context) (*Story, error)
- func (sq *StoryQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)
- func (sq *StoryQuery) OnlyIDX(ctx context.Context) uuid.UUID
- func (sq *StoryQuery) OnlyX(ctx context.Context) *Story
- func (sq *StoryQuery) Order(o ...story.OrderOption) *StoryQuery
- func (sq *StoryQuery) QuerySentences() *SentenceQuery
- func (sq *StoryQuery) Select(fields ...string) *StorySelect
- func (sq *StoryQuery) Unique(unique bool) *StoryQuery
- func (sq *StoryQuery) Where(ps ...predicate.Story) *StoryQuery
- func (sq *StoryQuery) WithSentences(opts ...func(*SentenceQuery)) *StoryQuery
- type StorySelect
- func (ss *StorySelect) Aggregate(fns ...AggregateFunc) *StorySelect
- func (s *StorySelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *StorySelect) BoolX(ctx context.Context) bool
- func (s *StorySelect) Bools(ctx context.Context) ([]bool, error)
- func (s *StorySelect) BoolsX(ctx context.Context) []bool
- func (s *StorySelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *StorySelect) Float64X(ctx context.Context) float64
- func (s *StorySelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *StorySelect) Float64sX(ctx context.Context) []float64
- func (s *StorySelect) Int(ctx context.Context) (_ int, err error)
- func (s *StorySelect) IntX(ctx context.Context) int
- func (s *StorySelect) Ints(ctx context.Context) ([]int, error)
- func (s *StorySelect) IntsX(ctx context.Context) []int
- func (ss *StorySelect) Scan(ctx context.Context, v any) error
- func (s *StorySelect) ScanX(ctx context.Context, v any)
- func (s *StorySelect) String(ctx context.Context) (_ string, err error)
- func (s *StorySelect) StringX(ctx context.Context) string
- func (s *StorySelect) Strings(ctx context.Context) ([]string, error)
- func (s *StorySelect) StringsX(ctx context.Context) []string
- type StoryUpdate
- func (su *StoryUpdate) AddSentenceIDs(ids ...uuid.UUID) *StoryUpdate
- func (su *StoryUpdate) AddSentences(s ...*Sentence) *StoryUpdate
- func (su *StoryUpdate) ClearSentences() *StoryUpdate
- func (su *StoryUpdate) Exec(ctx context.Context) error
- func (su *StoryUpdate) ExecX(ctx context.Context)
- func (su *StoryUpdate) Mutation() *StoryMutation
- func (su *StoryUpdate) RemoveSentenceIDs(ids ...uuid.UUID) *StoryUpdate
- func (su *StoryUpdate) RemoveSentences(s ...*Sentence) *StoryUpdate
- func (su *StoryUpdate) Save(ctx context.Context) (int, error)
- func (su *StoryUpdate) SaveX(ctx context.Context) int
- func (su *StoryUpdate) SetCreatedAt(t time.Time) *StoryUpdate
- func (su *StoryUpdate) SetNillableCreatedAt(t *time.Time) *StoryUpdate
- func (su *StoryUpdate) SetNillableStatus(s *story.Status) *StoryUpdate
- func (su *StoryUpdate) SetStatus(s story.Status) *StoryUpdate
- func (su *StoryUpdate) SetUpdatedAt(t time.Time) *StoryUpdate
- func (su *StoryUpdate) Where(ps ...predicate.Story) *StoryUpdate
- type StoryUpdateOne
- func (suo *StoryUpdateOne) AddSentenceIDs(ids ...uuid.UUID) *StoryUpdateOne
- func (suo *StoryUpdateOne) AddSentences(s ...*Sentence) *StoryUpdateOne
- func (suo *StoryUpdateOne) ClearSentences() *StoryUpdateOne
- func (suo *StoryUpdateOne) Exec(ctx context.Context) error
- func (suo *StoryUpdateOne) ExecX(ctx context.Context)
- func (suo *StoryUpdateOne) Mutation() *StoryMutation
- func (suo *StoryUpdateOne) RemoveSentenceIDs(ids ...uuid.UUID) *StoryUpdateOne
- func (suo *StoryUpdateOne) RemoveSentences(s ...*Sentence) *StoryUpdateOne
- func (suo *StoryUpdateOne) Save(ctx context.Context) (*Story, error)
- func (suo *StoryUpdateOne) SaveX(ctx context.Context) *Story
- func (suo *StoryUpdateOne) Select(field string, fields ...string) *StoryUpdateOne
- func (suo *StoryUpdateOne) SetCreatedAt(t time.Time) *StoryUpdateOne
- func (suo *StoryUpdateOne) SetNillableCreatedAt(t *time.Time) *StoryUpdateOne
- func (suo *StoryUpdateOne) SetNillableStatus(s *story.Status) *StoryUpdateOne
- func (suo *StoryUpdateOne) SetStatus(s story.Status) *StoryUpdateOne
- func (suo *StoryUpdateOne) SetUpdatedAt(t time.Time) *StoryUpdateOne
- func (suo *StoryUpdateOne) Where(ps ...predicate.Story) *StoryUpdateOne
- type TraverseFunc
- type Traverser
- type Tx
- type User
- 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 uuid.UUID) *UserDeleteOne
- func (c *UserClient) Get(ctx context.Context, id uuid.UUID) (*User, error)
- func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User
- func (c *UserClient) Hooks() []Hook
- func (c *UserClient) Intercept(interceptors ...Interceptor)
- func (c *UserClient) Interceptors() []Interceptor
- func (c *UserClient) Query() *UserQuery
- func (c *UserClient) QuerySentences(u *User) *SentenceQuery
- func (c *UserClient) Update() *UserUpdate
- func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
- func (c *UserClient) UpdateOneID(id uuid.UUID) *UserUpdateOne
- func (c *UserClient) Use(hooks ...Hook)
- type UserCreate
- func (uc *UserCreate) AddSentenceIDs(ids ...uuid.UUID) *UserCreate
- func (uc *UserCreate) AddSentences(s ...*Sentence) *UserCreate
- func (uc *UserCreate) Exec(ctx context.Context) error
- func (uc *UserCreate) ExecX(ctx context.Context)
- func (uc *UserCreate) Mutation() *UserMutation
- func (uc *UserCreate) Save(ctx context.Context) (*User, error)
- func (uc *UserCreate) SaveX(ctx context.Context) *User
- func (uc *UserCreate) SetID(u uuid.UUID) *UserCreate
- func (uc *UserCreate) SetIPAddress(s string) *UserCreate
- func (uc *UserCreate) SetNillableID(u *uuid.UUID) *UserCreate
- type UserCreateBulk
- type UserDelete
- type UserDeleteOne
- type UserEdges
- 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) AddField(name string, value ent.Value) error
- func (m *UserMutation) AddSentenceIDs(ids ...uuid.UUID)
- 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) ClearEdge(name string) error
- func (m *UserMutation) ClearField(name string) error
- func (m *UserMutation) ClearSentences()
- 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) ID() (id uuid.UUID, exists bool)
- func (m *UserMutation) IDs(ctx context.Context) ([]uuid.UUID, error)
- func (m *UserMutation) IPAddress() (r string, exists bool)
- func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *UserMutation) OldIPAddress(ctx context.Context) (v string, err error)
- func (m *UserMutation) Op() Op
- func (m *UserMutation) RemoveSentenceIDs(ids ...uuid.UUID)
- func (m *UserMutation) RemovedEdges() []string
- func (m *UserMutation) RemovedIDs(name string) []ent.Value
- func (m *UserMutation) RemovedSentencesIDs() (ids []uuid.UUID)
- func (m *UserMutation) ResetEdge(name string) error
- func (m *UserMutation) ResetField(name string) error
- func (m *UserMutation) ResetIPAddress()
- func (m *UserMutation) ResetSentences()
- func (m *UserMutation) SentencesCleared() bool
- func (m *UserMutation) SentencesIDs() (ids []uuid.UUID)
- func (m *UserMutation) SetField(name string, value ent.Value) error
- func (m *UserMutation) SetID(id uuid.UUID)
- func (m *UserMutation) SetIPAddress(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 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 (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) First(ctx context.Context) (*User, error)
- func (uq *UserQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)
- func (uq *UserQuery) FirstIDX(ctx context.Context) uuid.UUID
- 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 []uuid.UUID, err error)
- func (uq *UserQuery) IDsX(ctx context.Context) []uuid.UUID
- 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 uuid.UUID, err error)
- func (uq *UserQuery) OnlyIDX(ctx context.Context) uuid.UUID
- func (uq *UserQuery) OnlyX(ctx context.Context) *User
- func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery
- func (uq *UserQuery) QuerySentences() *SentenceQuery
- 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) WithSentences(opts ...func(*SentenceQuery)) *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) AddSentenceIDs(ids ...uuid.UUID) *UserUpdate
- func (uu *UserUpdate) AddSentences(s ...*Sentence) *UserUpdate
- func (uu *UserUpdate) ClearSentences() *UserUpdate
- func (uu *UserUpdate) Exec(ctx context.Context) error
- func (uu *UserUpdate) ExecX(ctx context.Context)
- func (uu *UserUpdate) Mutation() *UserMutation
- func (uu *UserUpdate) RemoveSentenceIDs(ids ...uuid.UUID) *UserUpdate
- func (uu *UserUpdate) RemoveSentences(s ...*Sentence) *UserUpdate
- func (uu *UserUpdate) Save(ctx context.Context) (int, error)
- func (uu *UserUpdate) SaveX(ctx context.Context) int
- func (uu *UserUpdate) SetIPAddress(s string) *UserUpdate
- func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
- type UserUpdateOne
- func (uuo *UserUpdateOne) AddSentenceIDs(ids ...uuid.UUID) *UserUpdateOne
- func (uuo *UserUpdateOne) AddSentences(s ...*Sentence) *UserUpdateOne
- func (uuo *UserUpdateOne) ClearSentences() *UserUpdateOne
- func (uuo *UserUpdateOne) Exec(ctx context.Context) error
- func (uuo *UserUpdateOne) ExecX(ctx context.Context)
- func (uuo *UserUpdateOne) Mutation() *UserMutation
- func (uuo *UserUpdateOne) RemoveSentenceIDs(ids ...uuid.UUID) *UserUpdateOne
- func (uuo *UserUpdateOne) RemoveSentences(s ...*Sentence) *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) SetIPAddress(s string) *UserUpdateOne
- func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne
- 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. TypeSentence = "Sentence" TypeStory = "Story" TypeUser = "User" )
Variables ¶
This section is empty.
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.
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
// Sentence is the client for interacting with the Sentence builders.
Sentence *SentenceClient
// Story is the client for interacting with the Story builders.
Story *StoryClient
// 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(). Sentence. 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(...)`.
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 InterceptFunc ¶
type InterceptFunc = ent.InterceptFunc
ent aliases to avoid import conflicts in user's code.
type Interceptor ¶
type Interceptor = ent.Interceptor
ent aliases to avoid import conflicts in user's code.
type MutateFunc ¶
type MutateFunc = ent.MutateFunc
ent aliases to avoid import conflicts in user's code.
type 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 Sentence ¶
type Sentence struct {
// ID of the ent.
ID uuid.UUID `json:"id,omitempty"`
// Text holds the value of the "text" field.
Text string `json:"text,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at,omitempty"`
// Order holds the value of the "order" field.
Order int `json:"order,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the SentenceQuery when eager-loading is set.
Edges SentenceEdges `json:"edges"`
// contains filtered or unexported fields
}
Sentence is the model entity for the Sentence schema.
func (*Sentence) QueryAuthor ¶
QueryAuthor queries the "author" edge of the Sentence entity.
func (*Sentence) QueryStory ¶
func (s *Sentence) QueryStory() *StoryQuery
QueryStory queries the "story" edge of the Sentence entity.
func (*Sentence) Unwrap ¶
Unwrap unwraps the Sentence 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 (*Sentence) Update ¶
func (s *Sentence) Update() *SentenceUpdateOne
Update returns a builder for updating this Sentence. Note that you need to call Sentence.Unwrap() before calling this method if this Sentence was returned from a transaction, and the transaction was committed or rolled back.
type SentenceClient ¶
type SentenceClient struct {
// contains filtered or unexported fields
}
SentenceClient is a client for the Sentence schema.
func NewSentenceClient ¶
func NewSentenceClient(c config) *SentenceClient
NewSentenceClient returns a client for the Sentence from the given config.
func (*SentenceClient) Create ¶
func (c *SentenceClient) Create() *SentenceCreate
Create returns a builder for creating a Sentence entity.
func (*SentenceClient) CreateBulk ¶
func (c *SentenceClient) CreateBulk(builders ...*SentenceCreate) *SentenceCreateBulk
CreateBulk returns a builder for creating a bulk of Sentence entities.
func (*SentenceClient) Delete ¶
func (c *SentenceClient) Delete() *SentenceDelete
Delete returns a delete builder for Sentence.
func (*SentenceClient) DeleteOne ¶
func (c *SentenceClient) DeleteOne(s *Sentence) *SentenceDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*SentenceClient) DeleteOneID ¶
func (c *SentenceClient) DeleteOneID(id uuid.UUID) *SentenceDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*SentenceClient) Hooks ¶
func (c *SentenceClient) Hooks() []Hook
Hooks returns the client hooks.
func (*SentenceClient) Intercept ¶
func (c *SentenceClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `sentence.Intercept(f(g(h())))`.
func (*SentenceClient) Interceptors ¶
func (c *SentenceClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*SentenceClient) Query ¶
func (c *SentenceClient) Query() *SentenceQuery
Query returns a query builder for Sentence.
func (*SentenceClient) QueryAuthor ¶
func (c *SentenceClient) QueryAuthor(s *Sentence) *UserQuery
QueryAuthor queries the author edge of a Sentence.
func (*SentenceClient) QueryStory ¶
func (c *SentenceClient) QueryStory(s *Sentence) *StoryQuery
QueryStory queries the story edge of a Sentence.
func (*SentenceClient) Update ¶
func (c *SentenceClient) Update() *SentenceUpdate
Update returns an update builder for Sentence.
func (*SentenceClient) UpdateOne ¶
func (c *SentenceClient) UpdateOne(s *Sentence) *SentenceUpdateOne
UpdateOne returns an update builder for the given entity.
func (*SentenceClient) UpdateOneID ¶
func (c *SentenceClient) UpdateOneID(id uuid.UUID) *SentenceUpdateOne
UpdateOneID returns an update builder for the given id.
func (*SentenceClient) Use ¶
func (c *SentenceClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `sentence.Hooks(f(g(h())))`.
type SentenceCreate ¶
type SentenceCreate struct {
// contains filtered or unexported fields
}
SentenceCreate is the builder for creating a Sentence entity.
func (*SentenceCreate) AddAuthor ¶
func (sc *SentenceCreate) AddAuthor(u ...*User) *SentenceCreate
AddAuthor adds the "author" edges to the User entity.
func (*SentenceCreate) AddAuthorIDs ¶
func (sc *SentenceCreate) AddAuthorIDs(ids ...uuid.UUID) *SentenceCreate
AddAuthorIDs adds the "author" edge to the User entity by IDs.
func (*SentenceCreate) Exec ¶
func (sc *SentenceCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*SentenceCreate) ExecX ¶
func (sc *SentenceCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*SentenceCreate) Mutation ¶
func (sc *SentenceCreate) Mutation() *SentenceMutation
Mutation returns the SentenceMutation object of the builder.
func (*SentenceCreate) Save ¶
func (sc *SentenceCreate) Save(ctx context.Context) (*Sentence, error)
Save creates the Sentence in the database.
func (*SentenceCreate) SaveX ¶
func (sc *SentenceCreate) SaveX(ctx context.Context) *Sentence
SaveX calls Save and panics if Save returns an error.
func (*SentenceCreate) SetCreatedAt ¶
func (sc *SentenceCreate) SetCreatedAt(t time.Time) *SentenceCreate
SetCreatedAt sets the "created_at" field.
func (*SentenceCreate) SetID ¶
func (sc *SentenceCreate) SetID(u uuid.UUID) *SentenceCreate
SetID sets the "id" field.
func (*SentenceCreate) SetNillableCreatedAt ¶
func (sc *SentenceCreate) SetNillableCreatedAt(t *time.Time) *SentenceCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*SentenceCreate) SetNillableID ¶
func (sc *SentenceCreate) SetNillableID(u *uuid.UUID) *SentenceCreate
SetNillableID sets the "id" field if the given value is not nil.
func (*SentenceCreate) SetOrder ¶
func (sc *SentenceCreate) SetOrder(i int) *SentenceCreate
SetOrder sets the "order" field.
func (*SentenceCreate) SetStory ¶
func (sc *SentenceCreate) SetStory(s *Story) *SentenceCreate
SetStory sets the "story" edge to the Story entity.
func (*SentenceCreate) SetStoryID ¶
func (sc *SentenceCreate) SetStoryID(id uuid.UUID) *SentenceCreate
SetStoryID sets the "story" edge to the Story entity by ID.
func (*SentenceCreate) SetText ¶
func (sc *SentenceCreate) SetText(s string) *SentenceCreate
SetText sets the "text" field.
type SentenceCreateBulk ¶
type SentenceCreateBulk struct {
// contains filtered or unexported fields
}
SentenceCreateBulk is the builder for creating many Sentence entities in bulk.
func (*SentenceCreateBulk) Exec ¶
func (scb *SentenceCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*SentenceCreateBulk) ExecX ¶
func (scb *SentenceCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type SentenceDelete ¶
type SentenceDelete struct {
// contains filtered or unexported fields
}
SentenceDelete is the builder for deleting a Sentence entity.
func (*SentenceDelete) Exec ¶
func (sd *SentenceDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*SentenceDelete) ExecX ¶
func (sd *SentenceDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*SentenceDelete) Where ¶
func (sd *SentenceDelete) Where(ps ...predicate.Sentence) *SentenceDelete
Where appends a list predicates to the SentenceDelete builder.
type SentenceDeleteOne ¶
type SentenceDeleteOne struct {
// contains filtered or unexported fields
}
SentenceDeleteOne is the builder for deleting a single Sentence entity.
func (*SentenceDeleteOne) Exec ¶
func (sdo *SentenceDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*SentenceDeleteOne) ExecX ¶
func (sdo *SentenceDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*SentenceDeleteOne) Where ¶
func (sdo *SentenceDeleteOne) Where(ps ...predicate.Sentence) *SentenceDeleteOne
Where appends a list predicates to the SentenceDelete builder.
type SentenceEdges ¶
type SentenceEdges struct {
// Story holds the value of the story edge.
Story *Story `json:"story,omitempty"`
// Author holds the value of the author edge.
Author []*User `json:"author,omitempty"`
// contains filtered or unexported fields
}
SentenceEdges holds the relations/edges for other nodes in the graph.
func (SentenceEdges) AuthorOrErr ¶
func (e SentenceEdges) AuthorOrErr() ([]*User, error)
AuthorOrErr returns the Author value or an error if the edge was not loaded in eager-loading.
func (SentenceEdges) StoryOrErr ¶
func (e SentenceEdges) StoryOrErr() (*Story, error)
StoryOrErr returns the Story value or an error if the edge was not loaded in eager-loading, or loaded but was not found.
type SentenceGroupBy ¶
type SentenceGroupBy struct {
// contains filtered or unexported fields
}
SentenceGroupBy is the group-by builder for Sentence entities.
func (*SentenceGroupBy) Aggregate ¶
func (sgb *SentenceGroupBy) Aggregate(fns ...AggregateFunc) *SentenceGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*SentenceGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*SentenceGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*SentenceGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*SentenceGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*SentenceGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*SentenceGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*SentenceGroupBy) Scan ¶
func (sgb *SentenceGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*SentenceGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type SentenceMutation ¶
type SentenceMutation struct {
// contains filtered or unexported fields
}
SentenceMutation represents an operation that mutates the Sentence nodes in the graph.
func (*SentenceMutation) AddAuthorIDs ¶
func (m *SentenceMutation) AddAuthorIDs(ids ...uuid.UUID)
AddAuthorIDs adds the "author" edge to the User entity by ids.
func (*SentenceMutation) AddField ¶
func (m *SentenceMutation) 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 (*SentenceMutation) AddOrder ¶
func (m *SentenceMutation) AddOrder(i int)
AddOrder adds i to the "order" field.
func (*SentenceMutation) AddedEdges ¶
func (m *SentenceMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*SentenceMutation) AddedField ¶
func (m *SentenceMutation) 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 (*SentenceMutation) AddedFields ¶
func (m *SentenceMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*SentenceMutation) AddedIDs ¶
func (m *SentenceMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*SentenceMutation) AddedOrder ¶
func (m *SentenceMutation) AddedOrder() (r int, exists bool)
AddedOrder returns the value that was added to the "order" field in this mutation.
func (*SentenceMutation) AuthorCleared ¶
func (m *SentenceMutation) AuthorCleared() bool
AuthorCleared reports if the "author" edge to the User entity was cleared.
func (*SentenceMutation) AuthorIDs ¶
func (m *SentenceMutation) AuthorIDs() (ids []uuid.UUID)
AuthorIDs returns the "author" edge IDs in the mutation.
func (*SentenceMutation) ClearAuthor ¶
func (m *SentenceMutation) ClearAuthor()
ClearAuthor clears the "author" edge to the User entity.
func (*SentenceMutation) ClearEdge ¶
func (m *SentenceMutation) 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 (*SentenceMutation) ClearField ¶
func (m *SentenceMutation) 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 (*SentenceMutation) ClearStory ¶
func (m *SentenceMutation) ClearStory()
ClearStory clears the "story" edge to the Story entity.
func (*SentenceMutation) ClearedEdges ¶
func (m *SentenceMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*SentenceMutation) ClearedFields ¶
func (m *SentenceMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (SentenceMutation) Client ¶
func (m SentenceMutation) 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 (*SentenceMutation) CreatedAt ¶
func (m *SentenceMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*SentenceMutation) EdgeCleared ¶
func (m *SentenceMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*SentenceMutation) Field ¶
func (m *SentenceMutation) 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 (*SentenceMutation) FieldCleared ¶
func (m *SentenceMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*SentenceMutation) Fields ¶
func (m *SentenceMutation) 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 (*SentenceMutation) ID ¶
func (m *SentenceMutation) ID() (id uuid.UUID, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*SentenceMutation) IDs ¶
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 (*SentenceMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Sentence entity. If the Sentence 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 (*SentenceMutation) 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 (*SentenceMutation) OldOrder ¶
func (m *SentenceMutation) OldOrder(ctx context.Context) (v int, err error)
OldOrder returns the old "order" field's value of the Sentence entity. If the Sentence 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 (*SentenceMutation) OldText ¶
func (m *SentenceMutation) OldText(ctx context.Context) (v string, err error)
OldText returns the old "text" field's value of the Sentence entity. If the Sentence 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 (*SentenceMutation) Order ¶
func (m *SentenceMutation) Order() (r int, exists bool)
Order returns the value of the "order" field in the mutation.
func (*SentenceMutation) RemoveAuthorIDs ¶
func (m *SentenceMutation) RemoveAuthorIDs(ids ...uuid.UUID)
RemoveAuthorIDs removes the "author" edge to the User entity by IDs.
func (*SentenceMutation) RemovedAuthorIDs ¶
func (m *SentenceMutation) RemovedAuthorIDs() (ids []uuid.UUID)
RemovedAuthor returns the removed IDs of the "author" edge to the User entity.
func (*SentenceMutation) RemovedEdges ¶
func (m *SentenceMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*SentenceMutation) RemovedIDs ¶
func (m *SentenceMutation) 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 (*SentenceMutation) ResetAuthor ¶
func (m *SentenceMutation) ResetAuthor()
ResetAuthor resets all changes to the "author" edge.
func (*SentenceMutation) ResetCreatedAt ¶
func (m *SentenceMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*SentenceMutation) ResetEdge ¶
func (m *SentenceMutation) 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 (*SentenceMutation) ResetField ¶
func (m *SentenceMutation) 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 (*SentenceMutation) ResetOrder ¶
func (m *SentenceMutation) ResetOrder()
ResetOrder resets all changes to the "order" field.
func (*SentenceMutation) ResetStory ¶
func (m *SentenceMutation) ResetStory()
ResetStory resets all changes to the "story" edge.
func (*SentenceMutation) ResetText ¶
func (m *SentenceMutation) ResetText()
ResetText resets all changes to the "text" field.
func (*SentenceMutation) SetCreatedAt ¶
func (m *SentenceMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*SentenceMutation) SetField ¶
func (m *SentenceMutation) 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 (*SentenceMutation) SetID ¶
func (m *SentenceMutation) SetID(id uuid.UUID)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Sentence entities.
func (*SentenceMutation) SetOp ¶
func (m *SentenceMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*SentenceMutation) SetOrder ¶
func (m *SentenceMutation) SetOrder(i int)
SetOrder sets the "order" field.
func (*SentenceMutation) SetStoryID ¶
func (m *SentenceMutation) SetStoryID(id uuid.UUID)
SetStoryID sets the "story" edge to the Story entity by id.
func (*SentenceMutation) SetText ¶
func (m *SentenceMutation) SetText(s string)
SetText sets the "text" field.
func (*SentenceMutation) StoryCleared ¶
func (m *SentenceMutation) StoryCleared() bool
StoryCleared reports if the "story" edge to the Story entity was cleared.
func (*SentenceMutation) StoryID ¶
func (m *SentenceMutation) StoryID() (id uuid.UUID, exists bool)
StoryID returns the "story" edge ID in the mutation.
func (*SentenceMutation) StoryIDs ¶
func (m *SentenceMutation) StoryIDs() (ids []uuid.UUID)
StoryIDs returns the "story" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use StoryID instead. It exists only for internal usage by the builders.
func (*SentenceMutation) Text ¶
func (m *SentenceMutation) Text() (r string, exists bool)
Text returns the value of the "text" field in the mutation.
func (SentenceMutation) Tx ¶
func (m SentenceMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*SentenceMutation) Type ¶
func (m *SentenceMutation) Type() string
Type returns the node type of this mutation (Sentence).
func (*SentenceMutation) Where ¶
func (m *SentenceMutation) Where(ps ...predicate.Sentence)
Where appends a list predicates to the SentenceMutation builder.
func (*SentenceMutation) WhereP ¶
func (m *SentenceMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the SentenceMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type SentenceQuery ¶
type SentenceQuery struct {
// contains filtered or unexported fields
}
SentenceQuery is the builder for querying Sentence entities.
func (*SentenceQuery) Aggregate ¶
func (sq *SentenceQuery) Aggregate(fns ...AggregateFunc) *SentenceSelect
Aggregate returns a SentenceSelect configured with the given aggregations.
func (*SentenceQuery) All ¶
func (sq *SentenceQuery) All(ctx context.Context) ([]*Sentence, error)
All executes the query and returns a list of Sentences.
func (*SentenceQuery) AllX ¶
func (sq *SentenceQuery) AllX(ctx context.Context) []*Sentence
AllX is like All, but panics if an error occurs.
func (*SentenceQuery) Clone ¶
func (sq *SentenceQuery) Clone() *SentenceQuery
Clone returns a duplicate of the SentenceQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*SentenceQuery) Count ¶
func (sq *SentenceQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*SentenceQuery) CountX ¶
func (sq *SentenceQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*SentenceQuery) Exist ¶
func (sq *SentenceQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*SentenceQuery) ExistX ¶
func (sq *SentenceQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*SentenceQuery) First ¶
func (sq *SentenceQuery) First(ctx context.Context) (*Sentence, error)
First returns the first Sentence entity from the query. Returns a *NotFoundError when no Sentence was found.
func (*SentenceQuery) FirstID ¶
FirstID returns the first Sentence ID from the query. Returns a *NotFoundError when no Sentence ID was found.
func (*SentenceQuery) FirstIDX ¶
func (sq *SentenceQuery) FirstIDX(ctx context.Context) uuid.UUID
FirstIDX is like FirstID, but panics if an error occurs.
func (*SentenceQuery) FirstX ¶
func (sq *SentenceQuery) FirstX(ctx context.Context) *Sentence
FirstX is like First, but panics if an error occurs.
func (*SentenceQuery) GroupBy ¶
func (sq *SentenceQuery) GroupBy(field string, fields ...string) *SentenceGroupBy
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.Sentence.Query().
GroupBy(sentence.FieldText).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*SentenceQuery) IDsX ¶
func (sq *SentenceQuery) IDsX(ctx context.Context) []uuid.UUID
IDsX is like IDs, but panics if an error occurs.
func (*SentenceQuery) Limit ¶
func (sq *SentenceQuery) Limit(limit int) *SentenceQuery
Limit the number of records to be returned by this query.
func (*SentenceQuery) Offset ¶
func (sq *SentenceQuery) Offset(offset int) *SentenceQuery
Offset to start from.
func (*SentenceQuery) Only ¶
func (sq *SentenceQuery) Only(ctx context.Context) (*Sentence, error)
Only returns a single Sentence entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Sentence entity is found. Returns a *NotFoundError when no Sentence entities are found.
func (*SentenceQuery) OnlyID ¶
OnlyID is like Only, but returns the only Sentence ID in the query. Returns a *NotSingularError when more than one Sentence ID is found. Returns a *NotFoundError when no entities are found.
func (*SentenceQuery) OnlyIDX ¶
func (sq *SentenceQuery) OnlyIDX(ctx context.Context) uuid.UUID
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*SentenceQuery) OnlyX ¶
func (sq *SentenceQuery) OnlyX(ctx context.Context) *Sentence
OnlyX is like Only, but panics if an error occurs.
func (*SentenceQuery) Order ¶
func (sq *SentenceQuery) Order(o ...sentence.OrderOption) *SentenceQuery
Order specifies how the records should be ordered.
func (*SentenceQuery) QueryAuthor ¶
func (sq *SentenceQuery) QueryAuthor() *UserQuery
QueryAuthor chains the current query on the "author" edge.
func (*SentenceQuery) QueryStory ¶
func (sq *SentenceQuery) QueryStory() *StoryQuery
QueryStory chains the current query on the "story" edge.
func (*SentenceQuery) Select ¶
func (sq *SentenceQuery) Select(fields ...string) *SentenceSelect
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.Sentence.Query().
Select(sentence.FieldText).
Scan(ctx, &v)
func (*SentenceQuery) Unique ¶
func (sq *SentenceQuery) Unique(unique bool) *SentenceQuery
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 (*SentenceQuery) Where ¶
func (sq *SentenceQuery) Where(ps ...predicate.Sentence) *SentenceQuery
Where adds a new predicate for the SentenceQuery builder.
func (*SentenceQuery) WithAuthor ¶
func (sq *SentenceQuery) WithAuthor(opts ...func(*UserQuery)) *SentenceQuery
WithAuthor tells the query-builder to eager-load the nodes that are connected to the "author" edge. The optional arguments are used to configure the query builder of the edge.
func (*SentenceQuery) WithStory ¶
func (sq *SentenceQuery) WithStory(opts ...func(*StoryQuery)) *SentenceQuery
WithStory tells the query-builder to eager-load the nodes that are connected to the "story" edge. The optional arguments are used to configure the query builder of the edge.
type SentenceSelect ¶
type SentenceSelect struct {
*SentenceQuery
// contains filtered or unexported fields
}
SentenceSelect is the builder for selecting fields of Sentence entities.
func (*SentenceSelect) Aggregate ¶
func (ss *SentenceSelect) Aggregate(fns ...AggregateFunc) *SentenceSelect
Aggregate adds the given aggregation functions to the selector query.
func (*SentenceSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*SentenceSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*SentenceSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*SentenceSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*SentenceSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*SentenceSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*SentenceSelect) Scan ¶
func (ss *SentenceSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*SentenceSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type SentenceUpdate ¶
type SentenceUpdate struct {
// contains filtered or unexported fields
}
SentenceUpdate is the builder for updating Sentence entities.
func (*SentenceUpdate) AddAuthor ¶
func (su *SentenceUpdate) AddAuthor(u ...*User) *SentenceUpdate
AddAuthor adds the "author" edges to the User entity.
func (*SentenceUpdate) AddAuthorIDs ¶
func (su *SentenceUpdate) AddAuthorIDs(ids ...uuid.UUID) *SentenceUpdate
AddAuthorIDs adds the "author" edge to the User entity by IDs.
func (*SentenceUpdate) AddOrder ¶
func (su *SentenceUpdate) AddOrder(i int) *SentenceUpdate
AddOrder adds i to the "order" field.
func (*SentenceUpdate) ClearAuthor ¶
func (su *SentenceUpdate) ClearAuthor() *SentenceUpdate
ClearAuthor clears all "author" edges to the User entity.
func (*SentenceUpdate) ClearStory ¶
func (su *SentenceUpdate) ClearStory() *SentenceUpdate
ClearStory clears the "story" edge to the Story entity.
func (*SentenceUpdate) Exec ¶
func (su *SentenceUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*SentenceUpdate) ExecX ¶
func (su *SentenceUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*SentenceUpdate) Mutation ¶
func (su *SentenceUpdate) Mutation() *SentenceMutation
Mutation returns the SentenceMutation object of the builder.
func (*SentenceUpdate) RemoveAuthor ¶
func (su *SentenceUpdate) RemoveAuthor(u ...*User) *SentenceUpdate
RemoveAuthor removes "author" edges to User entities.
func (*SentenceUpdate) RemoveAuthorIDs ¶
func (su *SentenceUpdate) RemoveAuthorIDs(ids ...uuid.UUID) *SentenceUpdate
RemoveAuthorIDs removes the "author" edge to User entities by IDs.
func (*SentenceUpdate) Save ¶
func (su *SentenceUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*SentenceUpdate) SaveX ¶
func (su *SentenceUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*SentenceUpdate) SetCreatedAt ¶
func (su *SentenceUpdate) SetCreatedAt(t time.Time) *SentenceUpdate
SetCreatedAt sets the "created_at" field.
func (*SentenceUpdate) SetNillableCreatedAt ¶
func (su *SentenceUpdate) SetNillableCreatedAt(t *time.Time) *SentenceUpdate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*SentenceUpdate) SetOrder ¶
func (su *SentenceUpdate) SetOrder(i int) *SentenceUpdate
SetOrder sets the "order" field.
func (*SentenceUpdate) SetStory ¶
func (su *SentenceUpdate) SetStory(s *Story) *SentenceUpdate
SetStory sets the "story" edge to the Story entity.
func (*SentenceUpdate) SetStoryID ¶
func (su *SentenceUpdate) SetStoryID(id uuid.UUID) *SentenceUpdate
SetStoryID sets the "story" edge to the Story entity by ID.
func (*SentenceUpdate) SetText ¶
func (su *SentenceUpdate) SetText(s string) *SentenceUpdate
SetText sets the "text" field.
func (*SentenceUpdate) Where ¶
func (su *SentenceUpdate) Where(ps ...predicate.Sentence) *SentenceUpdate
Where appends a list predicates to the SentenceUpdate builder.
type SentenceUpdateOne ¶
type SentenceUpdateOne struct {
// contains filtered or unexported fields
}
SentenceUpdateOne is the builder for updating a single Sentence entity.
func (*SentenceUpdateOne) AddAuthor ¶
func (suo *SentenceUpdateOne) AddAuthor(u ...*User) *SentenceUpdateOne
AddAuthor adds the "author" edges to the User entity.
func (*SentenceUpdateOne) AddAuthorIDs ¶
func (suo *SentenceUpdateOne) AddAuthorIDs(ids ...uuid.UUID) *SentenceUpdateOne
AddAuthorIDs adds the "author" edge to the User entity by IDs.
func (*SentenceUpdateOne) AddOrder ¶
func (suo *SentenceUpdateOne) AddOrder(i int) *SentenceUpdateOne
AddOrder adds i to the "order" field.
func (*SentenceUpdateOne) ClearAuthor ¶
func (suo *SentenceUpdateOne) ClearAuthor() *SentenceUpdateOne
ClearAuthor clears all "author" edges to the User entity.
func (*SentenceUpdateOne) ClearStory ¶
func (suo *SentenceUpdateOne) ClearStory() *SentenceUpdateOne
ClearStory clears the "story" edge to the Story entity.
func (*SentenceUpdateOne) Exec ¶
func (suo *SentenceUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*SentenceUpdateOne) ExecX ¶
func (suo *SentenceUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*SentenceUpdateOne) Mutation ¶
func (suo *SentenceUpdateOne) Mutation() *SentenceMutation
Mutation returns the SentenceMutation object of the builder.
func (*SentenceUpdateOne) RemoveAuthor ¶
func (suo *SentenceUpdateOne) RemoveAuthor(u ...*User) *SentenceUpdateOne
RemoveAuthor removes "author" edges to User entities.
func (*SentenceUpdateOne) RemoveAuthorIDs ¶
func (suo *SentenceUpdateOne) RemoveAuthorIDs(ids ...uuid.UUID) *SentenceUpdateOne
RemoveAuthorIDs removes the "author" edge to User entities by IDs.
func (*SentenceUpdateOne) Save ¶
func (suo *SentenceUpdateOne) Save(ctx context.Context) (*Sentence, error)
Save executes the query and returns the updated Sentence entity.
func (*SentenceUpdateOne) SaveX ¶
func (suo *SentenceUpdateOne) SaveX(ctx context.Context) *Sentence
SaveX is like Save, but panics if an error occurs.
func (*SentenceUpdateOne) Select ¶
func (suo *SentenceUpdateOne) Select(field string, fields ...string) *SentenceUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*SentenceUpdateOne) SetCreatedAt ¶
func (suo *SentenceUpdateOne) SetCreatedAt(t time.Time) *SentenceUpdateOne
SetCreatedAt sets the "created_at" field.
func (*SentenceUpdateOne) SetNillableCreatedAt ¶
func (suo *SentenceUpdateOne) SetNillableCreatedAt(t *time.Time) *SentenceUpdateOne
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*SentenceUpdateOne) SetOrder ¶
func (suo *SentenceUpdateOne) SetOrder(i int) *SentenceUpdateOne
SetOrder sets the "order" field.
func (*SentenceUpdateOne) SetStory ¶
func (suo *SentenceUpdateOne) SetStory(s *Story) *SentenceUpdateOne
SetStory sets the "story" edge to the Story entity.
func (*SentenceUpdateOne) SetStoryID ¶
func (suo *SentenceUpdateOne) SetStoryID(id uuid.UUID) *SentenceUpdateOne
SetStoryID sets the "story" edge to the Story entity by ID.
func (*SentenceUpdateOne) SetText ¶
func (suo *SentenceUpdateOne) SetText(s string) *SentenceUpdateOne
SetText sets the "text" field.
func (*SentenceUpdateOne) Where ¶
func (suo *SentenceUpdateOne) Where(ps ...predicate.Sentence) *SentenceUpdateOne
Where appends a list predicates to the SentenceUpdate builder.
type Story ¶
type Story struct {
// ID of the ent.
ID uuid.UUID `json:"id,omitempty"`
// Status holds the value of the "status" field.
Status story.Status `json:"status,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
UpdatedAt time.Time `json:"updated_at,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the StoryQuery when eager-loading is set.
Edges StoryEdges `json:"edges"`
// contains filtered or unexported fields
}
Story is the model entity for the Story schema.
func (*Story) QuerySentences ¶
func (s *Story) QuerySentences() *SentenceQuery
QuerySentences queries the "sentences" edge of the Story entity.
func (*Story) Unwrap ¶
Unwrap unwraps the Story 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 (*Story) Update ¶
func (s *Story) Update() *StoryUpdateOne
Update returns a builder for updating this Story. Note that you need to call Story.Unwrap() before calling this method if this Story was returned from a transaction, and the transaction was committed or rolled back.
type StoryClient ¶
type StoryClient struct {
// contains filtered or unexported fields
}
StoryClient is a client for the Story schema.
func NewStoryClient ¶
func NewStoryClient(c config) *StoryClient
NewStoryClient returns a client for the Story from the given config.
func (*StoryClient) Create ¶
func (c *StoryClient) Create() *StoryCreate
Create returns a builder for creating a Story entity.
func (*StoryClient) CreateBulk ¶
func (c *StoryClient) CreateBulk(builders ...*StoryCreate) *StoryCreateBulk
CreateBulk returns a builder for creating a bulk of Story entities.
func (*StoryClient) Delete ¶
func (c *StoryClient) Delete() *StoryDelete
Delete returns a delete builder for Story.
func (*StoryClient) DeleteOne ¶
func (c *StoryClient) DeleteOne(s *Story) *StoryDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*StoryClient) DeleteOneID ¶
func (c *StoryClient) DeleteOneID(id uuid.UUID) *StoryDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*StoryClient) Intercept ¶
func (c *StoryClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `story.Intercept(f(g(h())))`.
func (*StoryClient) Interceptors ¶
func (c *StoryClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*StoryClient) Query ¶
func (c *StoryClient) Query() *StoryQuery
Query returns a query builder for Story.
func (*StoryClient) QuerySentences ¶
func (c *StoryClient) QuerySentences(s *Story) *SentenceQuery
QuerySentences queries the sentences edge of a Story.
func (*StoryClient) Update ¶
func (c *StoryClient) Update() *StoryUpdate
Update returns an update builder for Story.
func (*StoryClient) UpdateOne ¶
func (c *StoryClient) UpdateOne(s *Story) *StoryUpdateOne
UpdateOne returns an update builder for the given entity.
func (*StoryClient) UpdateOneID ¶
func (c *StoryClient) UpdateOneID(id uuid.UUID) *StoryUpdateOne
UpdateOneID returns an update builder for the given id.
func (*StoryClient) Use ¶
func (c *StoryClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `story.Hooks(f(g(h())))`.
type StoryCreate ¶
type StoryCreate struct {
// contains filtered or unexported fields
}
StoryCreate is the builder for creating a Story entity.
func (*StoryCreate) AddSentenceIDs ¶
func (sc *StoryCreate) AddSentenceIDs(ids ...uuid.UUID) *StoryCreate
AddSentenceIDs adds the "sentences" edge to the Sentence entity by IDs.
func (*StoryCreate) AddSentences ¶
func (sc *StoryCreate) AddSentences(s ...*Sentence) *StoryCreate
AddSentences adds the "sentences" edges to the Sentence entity.
func (*StoryCreate) Exec ¶
func (sc *StoryCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*StoryCreate) ExecX ¶
func (sc *StoryCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*StoryCreate) Mutation ¶
func (sc *StoryCreate) Mutation() *StoryMutation
Mutation returns the StoryMutation object of the builder.
func (*StoryCreate) Save ¶
func (sc *StoryCreate) Save(ctx context.Context) (*Story, error)
Save creates the Story in the database.
func (*StoryCreate) SaveX ¶
func (sc *StoryCreate) SaveX(ctx context.Context) *Story
SaveX calls Save and panics if Save returns an error.
func (*StoryCreate) SetCreatedAt ¶
func (sc *StoryCreate) SetCreatedAt(t time.Time) *StoryCreate
SetCreatedAt sets the "created_at" field.
func (*StoryCreate) SetID ¶
func (sc *StoryCreate) SetID(u uuid.UUID) *StoryCreate
SetID sets the "id" field.
func (*StoryCreate) SetNillableCreatedAt ¶
func (sc *StoryCreate) SetNillableCreatedAt(t *time.Time) *StoryCreate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*StoryCreate) SetNillableID ¶
func (sc *StoryCreate) SetNillableID(u *uuid.UUID) *StoryCreate
SetNillableID sets the "id" field if the given value is not nil.
func (*StoryCreate) SetNillableStatus ¶
func (sc *StoryCreate) SetNillableStatus(s *story.Status) *StoryCreate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*StoryCreate) SetStatus ¶
func (sc *StoryCreate) SetStatus(s story.Status) *StoryCreate
SetStatus sets the "status" field.
func (*StoryCreate) SetUpdatedAt ¶
func (sc *StoryCreate) SetUpdatedAt(t time.Time) *StoryCreate
SetUpdatedAt sets the "updated_at" field.
type StoryCreateBulk ¶
type StoryCreateBulk struct {
// contains filtered or unexported fields
}
StoryCreateBulk is the builder for creating many Story entities in bulk.
func (*StoryCreateBulk) Exec ¶
func (scb *StoryCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*StoryCreateBulk) ExecX ¶
func (scb *StoryCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type StoryDelete ¶
type StoryDelete struct {
// contains filtered or unexported fields
}
StoryDelete is the builder for deleting a Story entity.
func (*StoryDelete) Exec ¶
func (sd *StoryDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*StoryDelete) ExecX ¶
func (sd *StoryDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*StoryDelete) Where ¶
func (sd *StoryDelete) Where(ps ...predicate.Story) *StoryDelete
Where appends a list predicates to the StoryDelete builder.
type StoryDeleteOne ¶
type StoryDeleteOne struct {
// contains filtered or unexported fields
}
StoryDeleteOne is the builder for deleting a single Story entity.
func (*StoryDeleteOne) Exec ¶
func (sdo *StoryDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*StoryDeleteOne) ExecX ¶
func (sdo *StoryDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*StoryDeleteOne) Where ¶
func (sdo *StoryDeleteOne) Where(ps ...predicate.Story) *StoryDeleteOne
Where appends a list predicates to the StoryDelete builder.
type StoryEdges ¶
type StoryEdges struct {
// Sentences holds the value of the sentences edge.
Sentences []*Sentence `json:"sentences,omitempty"`
// contains filtered or unexported fields
}
StoryEdges holds the relations/edges for other nodes in the graph.
func (StoryEdges) SentencesOrErr ¶
func (e StoryEdges) SentencesOrErr() ([]*Sentence, error)
SentencesOrErr returns the Sentences value or an error if the edge was not loaded in eager-loading.
type StoryGroupBy ¶
type StoryGroupBy struct {
// contains filtered or unexported fields
}
StoryGroupBy is the group-by builder for Story entities.
func (*StoryGroupBy) Aggregate ¶
func (sgb *StoryGroupBy) Aggregate(fns ...AggregateFunc) *StoryGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*StoryGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*StoryGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*StoryGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*StoryGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*StoryGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*StoryGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*StoryGroupBy) Scan ¶
func (sgb *StoryGroupBy) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*StoryGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type StoryMutation ¶
type StoryMutation struct {
// contains filtered or unexported fields
}
StoryMutation represents an operation that mutates the Story nodes in the graph.
func (*StoryMutation) AddField ¶
func (m *StoryMutation) 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 (*StoryMutation) AddSentenceIDs ¶
func (m *StoryMutation) AddSentenceIDs(ids ...uuid.UUID)
AddSentenceIDs adds the "sentences" edge to the Sentence entity by ids.
func (*StoryMutation) AddedEdges ¶
func (m *StoryMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*StoryMutation) AddedField ¶
func (m *StoryMutation) 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 (*StoryMutation) AddedFields ¶
func (m *StoryMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*StoryMutation) AddedIDs ¶
func (m *StoryMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*StoryMutation) ClearEdge ¶
func (m *StoryMutation) 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 (*StoryMutation) ClearField ¶
func (m *StoryMutation) 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 (*StoryMutation) ClearSentences ¶
func (m *StoryMutation) ClearSentences()
ClearSentences clears the "sentences" edge to the Sentence entity.
func (*StoryMutation) ClearedEdges ¶
func (m *StoryMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*StoryMutation) ClearedFields ¶
func (m *StoryMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (StoryMutation) Client ¶
func (m StoryMutation) 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 (*StoryMutation) CreatedAt ¶
func (m *StoryMutation) CreatedAt() (r time.Time, exists bool)
CreatedAt returns the value of the "created_at" field in the mutation.
func (*StoryMutation) EdgeCleared ¶
func (m *StoryMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*StoryMutation) Field ¶
func (m *StoryMutation) 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 (*StoryMutation) FieldCleared ¶
func (m *StoryMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*StoryMutation) Fields ¶
func (m *StoryMutation) 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 (*StoryMutation) ID ¶
func (m *StoryMutation) ID() (id uuid.UUID, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*StoryMutation) IDs ¶
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 (*StoryMutation) OldCreatedAt ¶
OldCreatedAt returns the old "created_at" field's value of the Story entity. If the Story 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 (*StoryMutation) 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 (*StoryMutation) OldStatus ¶
OldStatus returns the old "status" field's value of the Story entity. If the Story 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 (*StoryMutation) OldUpdatedAt ¶
OldUpdatedAt returns the old "updated_at" field's value of the Story entity. If the Story 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 (*StoryMutation) RemoveSentenceIDs ¶
func (m *StoryMutation) RemoveSentenceIDs(ids ...uuid.UUID)
RemoveSentenceIDs removes the "sentences" edge to the Sentence entity by IDs.
func (*StoryMutation) RemovedEdges ¶
func (m *StoryMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*StoryMutation) RemovedIDs ¶
func (m *StoryMutation) 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 (*StoryMutation) RemovedSentencesIDs ¶
func (m *StoryMutation) RemovedSentencesIDs() (ids []uuid.UUID)
RemovedSentences returns the removed IDs of the "sentences" edge to the Sentence entity.
func (*StoryMutation) ResetCreatedAt ¶
func (m *StoryMutation) ResetCreatedAt()
ResetCreatedAt resets all changes to the "created_at" field.
func (*StoryMutation) ResetEdge ¶
func (m *StoryMutation) 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 (*StoryMutation) ResetField ¶
func (m *StoryMutation) 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 (*StoryMutation) ResetSentences ¶
func (m *StoryMutation) ResetSentences()
ResetSentences resets all changes to the "sentences" edge.
func (*StoryMutation) ResetStatus ¶
func (m *StoryMutation) ResetStatus()
ResetStatus resets all changes to the "status" field.
func (*StoryMutation) ResetUpdatedAt ¶
func (m *StoryMutation) ResetUpdatedAt()
ResetUpdatedAt resets all changes to the "updated_at" field.
func (*StoryMutation) SentencesCleared ¶
func (m *StoryMutation) SentencesCleared() bool
SentencesCleared reports if the "sentences" edge to the Sentence entity was cleared.
func (*StoryMutation) SentencesIDs ¶
func (m *StoryMutation) SentencesIDs() (ids []uuid.UUID)
SentencesIDs returns the "sentences" edge IDs in the mutation.
func (*StoryMutation) SetCreatedAt ¶
func (m *StoryMutation) SetCreatedAt(t time.Time)
SetCreatedAt sets the "created_at" field.
func (*StoryMutation) SetField ¶
func (m *StoryMutation) 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 (*StoryMutation) SetID ¶
func (m *StoryMutation) SetID(id uuid.UUID)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Story entities.
func (*StoryMutation) SetOp ¶
func (m *StoryMutation) SetOp(op Op)
SetOp allows setting the mutation operation.
func (*StoryMutation) SetStatus ¶
func (m *StoryMutation) SetStatus(s story.Status)
SetStatus sets the "status" field.
func (*StoryMutation) SetUpdatedAt ¶
func (m *StoryMutation) SetUpdatedAt(t time.Time)
SetUpdatedAt sets the "updated_at" field.
func (*StoryMutation) Status ¶
func (m *StoryMutation) Status() (r story.Status, exists bool)
Status returns the value of the "status" field in the mutation.
func (StoryMutation) Tx ¶
func (m StoryMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*StoryMutation) Type ¶
func (m *StoryMutation) Type() string
Type returns the node type of this mutation (Story).
func (*StoryMutation) UpdatedAt ¶
func (m *StoryMutation) UpdatedAt() (r time.Time, exists bool)
UpdatedAt returns the value of the "updated_at" field in the mutation.
func (*StoryMutation) Where ¶
func (m *StoryMutation) Where(ps ...predicate.Story)
Where appends a list predicates to the StoryMutation builder.
func (*StoryMutation) WhereP ¶
func (m *StoryMutation) WhereP(ps ...func(*sql.Selector))
WhereP appends storage-level predicates to the StoryMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.
type StoryQuery ¶
type StoryQuery struct {
// contains filtered or unexported fields
}
StoryQuery is the builder for querying Story entities.
func (*StoryQuery) Aggregate ¶
func (sq *StoryQuery) Aggregate(fns ...AggregateFunc) *StorySelect
Aggregate returns a StorySelect configured with the given aggregations.
func (*StoryQuery) All ¶
func (sq *StoryQuery) All(ctx context.Context) ([]*Story, error)
All executes the query and returns a list of Stories.
func (*StoryQuery) AllX ¶
func (sq *StoryQuery) AllX(ctx context.Context) []*Story
AllX is like All, but panics if an error occurs.
func (*StoryQuery) Clone ¶
func (sq *StoryQuery) Clone() *StoryQuery
Clone returns a duplicate of the StoryQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*StoryQuery) Count ¶
func (sq *StoryQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*StoryQuery) CountX ¶
func (sq *StoryQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*StoryQuery) Exist ¶
func (sq *StoryQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*StoryQuery) ExistX ¶
func (sq *StoryQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*StoryQuery) First ¶
func (sq *StoryQuery) First(ctx context.Context) (*Story, error)
First returns the first Story entity from the query. Returns a *NotFoundError when no Story was found.
func (*StoryQuery) FirstID ¶
FirstID returns the first Story ID from the query. Returns a *NotFoundError when no Story ID was found.
func (*StoryQuery) FirstIDX ¶
func (sq *StoryQuery) FirstIDX(ctx context.Context) uuid.UUID
FirstIDX is like FirstID, but panics if an error occurs.
func (*StoryQuery) FirstX ¶
func (sq *StoryQuery) FirstX(ctx context.Context) *Story
FirstX is like First, but panics if an error occurs.
func (*StoryQuery) GroupBy ¶
func (sq *StoryQuery) GroupBy(field string, fields ...string) *StoryGroupBy
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 {
Status story.Status `json:"status,omitempty"`
Count int `json:"count,omitempty"`
}
client.Story.Query().
GroupBy(story.FieldStatus).
Aggregate(ent.Count()).
Scan(ctx, &v)
func (*StoryQuery) IDsX ¶
func (sq *StoryQuery) IDsX(ctx context.Context) []uuid.UUID
IDsX is like IDs, but panics if an error occurs.
func (*StoryQuery) Limit ¶
func (sq *StoryQuery) Limit(limit int) *StoryQuery
Limit the number of records to be returned by this query.
func (*StoryQuery) Offset ¶
func (sq *StoryQuery) Offset(offset int) *StoryQuery
Offset to start from.
func (*StoryQuery) Only ¶
func (sq *StoryQuery) Only(ctx context.Context) (*Story, error)
Only returns a single Story entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Story entity is found. Returns a *NotFoundError when no Story entities are found.
func (*StoryQuery) OnlyID ¶
OnlyID is like Only, but returns the only Story ID in the query. Returns a *NotSingularError when more than one Story ID is found. Returns a *NotFoundError when no entities are found.
func (*StoryQuery) OnlyIDX ¶
func (sq *StoryQuery) OnlyIDX(ctx context.Context) uuid.UUID
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*StoryQuery) OnlyX ¶
func (sq *StoryQuery) OnlyX(ctx context.Context) *Story
OnlyX is like Only, but panics if an error occurs.
func (*StoryQuery) Order ¶
func (sq *StoryQuery) Order(o ...story.OrderOption) *StoryQuery
Order specifies how the records should be ordered.
func (*StoryQuery) QuerySentences ¶
func (sq *StoryQuery) QuerySentences() *SentenceQuery
QuerySentences chains the current query on the "sentences" edge.
func (*StoryQuery) Select ¶
func (sq *StoryQuery) Select(fields ...string) *StorySelect
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 {
Status story.Status `json:"status,omitempty"`
}
client.Story.Query().
Select(story.FieldStatus).
Scan(ctx, &v)
func (*StoryQuery) Unique ¶
func (sq *StoryQuery) Unique(unique bool) *StoryQuery
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 (*StoryQuery) Where ¶
func (sq *StoryQuery) Where(ps ...predicate.Story) *StoryQuery
Where adds a new predicate for the StoryQuery builder.
func (*StoryQuery) WithSentences ¶
func (sq *StoryQuery) WithSentences(opts ...func(*SentenceQuery)) *StoryQuery
WithSentences tells the query-builder to eager-load the nodes that are connected to the "sentences" edge. The optional arguments are used to configure the query builder of the edge.
type StorySelect ¶
type StorySelect struct {
*StoryQuery
// contains filtered or unexported fields
}
StorySelect is the builder for selecting fields of Story entities.
func (*StorySelect) Aggregate ¶
func (ss *StorySelect) Aggregate(fns ...AggregateFunc) *StorySelect
Aggregate adds the given aggregation functions to the selector query.
func (*StorySelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*StorySelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*StorySelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*StorySelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*StorySelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*StorySelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*StorySelect) Scan ¶
func (ss *StorySelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*StorySelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type StoryUpdate ¶
type StoryUpdate struct {
// contains filtered or unexported fields
}
StoryUpdate is the builder for updating Story entities.
func (*StoryUpdate) AddSentenceIDs ¶
func (su *StoryUpdate) AddSentenceIDs(ids ...uuid.UUID) *StoryUpdate
AddSentenceIDs adds the "sentences" edge to the Sentence entity by IDs.
func (*StoryUpdate) AddSentences ¶
func (su *StoryUpdate) AddSentences(s ...*Sentence) *StoryUpdate
AddSentences adds the "sentences" edges to the Sentence entity.
func (*StoryUpdate) ClearSentences ¶
func (su *StoryUpdate) ClearSentences() *StoryUpdate
ClearSentences clears all "sentences" edges to the Sentence entity.
func (*StoryUpdate) Exec ¶
func (su *StoryUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*StoryUpdate) ExecX ¶
func (su *StoryUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*StoryUpdate) Mutation ¶
func (su *StoryUpdate) Mutation() *StoryMutation
Mutation returns the StoryMutation object of the builder.
func (*StoryUpdate) RemoveSentenceIDs ¶
func (su *StoryUpdate) RemoveSentenceIDs(ids ...uuid.UUID) *StoryUpdate
RemoveSentenceIDs removes the "sentences" edge to Sentence entities by IDs.
func (*StoryUpdate) RemoveSentences ¶
func (su *StoryUpdate) RemoveSentences(s ...*Sentence) *StoryUpdate
RemoveSentences removes "sentences" edges to Sentence entities.
func (*StoryUpdate) Save ¶
func (su *StoryUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*StoryUpdate) SaveX ¶
func (su *StoryUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*StoryUpdate) SetCreatedAt ¶
func (su *StoryUpdate) SetCreatedAt(t time.Time) *StoryUpdate
SetCreatedAt sets the "created_at" field.
func (*StoryUpdate) SetNillableCreatedAt ¶
func (su *StoryUpdate) SetNillableCreatedAt(t *time.Time) *StoryUpdate
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*StoryUpdate) SetNillableStatus ¶
func (su *StoryUpdate) SetNillableStatus(s *story.Status) *StoryUpdate
SetNillableStatus sets the "status" field if the given value is not nil.
func (*StoryUpdate) SetStatus ¶
func (su *StoryUpdate) SetStatus(s story.Status) *StoryUpdate
SetStatus sets the "status" field.
func (*StoryUpdate) SetUpdatedAt ¶
func (su *StoryUpdate) SetUpdatedAt(t time.Time) *StoryUpdate
SetUpdatedAt sets the "updated_at" field.
func (*StoryUpdate) Where ¶
func (su *StoryUpdate) Where(ps ...predicate.Story) *StoryUpdate
Where appends a list predicates to the StoryUpdate builder.
type StoryUpdateOne ¶
type StoryUpdateOne struct {
// contains filtered or unexported fields
}
StoryUpdateOne is the builder for updating a single Story entity.
func (*StoryUpdateOne) AddSentenceIDs ¶
func (suo *StoryUpdateOne) AddSentenceIDs(ids ...uuid.UUID) *StoryUpdateOne
AddSentenceIDs adds the "sentences" edge to the Sentence entity by IDs.
func (*StoryUpdateOne) AddSentences ¶
func (suo *StoryUpdateOne) AddSentences(s ...*Sentence) *StoryUpdateOne
AddSentences adds the "sentences" edges to the Sentence entity.
func (*StoryUpdateOne) ClearSentences ¶
func (suo *StoryUpdateOne) ClearSentences() *StoryUpdateOne
ClearSentences clears all "sentences" edges to the Sentence entity.
func (*StoryUpdateOne) Exec ¶
func (suo *StoryUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*StoryUpdateOne) ExecX ¶
func (suo *StoryUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*StoryUpdateOne) Mutation ¶
func (suo *StoryUpdateOne) Mutation() *StoryMutation
Mutation returns the StoryMutation object of the builder.
func (*StoryUpdateOne) RemoveSentenceIDs ¶
func (suo *StoryUpdateOne) RemoveSentenceIDs(ids ...uuid.UUID) *StoryUpdateOne
RemoveSentenceIDs removes the "sentences" edge to Sentence entities by IDs.
func (*StoryUpdateOne) RemoveSentences ¶
func (suo *StoryUpdateOne) RemoveSentences(s ...*Sentence) *StoryUpdateOne
RemoveSentences removes "sentences" edges to Sentence entities.
func (*StoryUpdateOne) Save ¶
func (suo *StoryUpdateOne) Save(ctx context.Context) (*Story, error)
Save executes the query and returns the updated Story entity.
func (*StoryUpdateOne) SaveX ¶
func (suo *StoryUpdateOne) SaveX(ctx context.Context) *Story
SaveX is like Save, but panics if an error occurs.
func (*StoryUpdateOne) Select ¶
func (suo *StoryUpdateOne) Select(field string, fields ...string) *StoryUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*StoryUpdateOne) SetCreatedAt ¶
func (suo *StoryUpdateOne) SetCreatedAt(t time.Time) *StoryUpdateOne
SetCreatedAt sets the "created_at" field.
func (*StoryUpdateOne) SetNillableCreatedAt ¶
func (suo *StoryUpdateOne) SetNillableCreatedAt(t *time.Time) *StoryUpdateOne
SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (*StoryUpdateOne) SetNillableStatus ¶
func (suo *StoryUpdateOne) SetNillableStatus(s *story.Status) *StoryUpdateOne
SetNillableStatus sets the "status" field if the given value is not nil.
func (*StoryUpdateOne) SetStatus ¶
func (suo *StoryUpdateOne) SetStatus(s story.Status) *StoryUpdateOne
SetStatus sets the "status" field.
func (*StoryUpdateOne) SetUpdatedAt ¶
func (suo *StoryUpdateOne) SetUpdatedAt(t time.Time) *StoryUpdateOne
SetUpdatedAt sets the "updated_at" field.
func (*StoryUpdateOne) Where ¶
func (suo *StoryUpdateOne) Where(ps ...predicate.Story) *StoryUpdateOne
Where appends a list predicates to the StoryUpdate builder.
type TraverseFunc ¶
type TraverseFunc = ent.TraverseFunc
ent aliases to avoid import conflicts in user's code.
type Tx ¶
type Tx struct {
// Sentence is the client for interacting with the Sentence builders.
Sentence *SentenceClient
// Story is the client for interacting with the Story builders.
Story *StoryClient
// 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 uuid.UUID `json:"id,omitempty"`
// IPAddress holds the value of the "ip_address" field.
IPAddress string `json:"ip_address,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) QuerySentences ¶
func (u *User) QuerySentences() *SentenceQuery
QuerySentences queries the "sentences" 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 uuid.UUID) *UserDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*UserClient) Intercept ¶
func (c *UserClient) Intercept(interceptors ...Interceptor)
Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `user.Intercept(f(g(h())))`.
func (*UserClient) Interceptors ¶
func (c *UserClient) Interceptors() []Interceptor
Interceptors returns the client interceptors.
func (*UserClient) Query ¶
func (c *UserClient) Query() *UserQuery
Query returns a query builder for User.
func (*UserClient) QuerySentences ¶
func (c *UserClient) QuerySentences(u *User) *SentenceQuery
QuerySentences queries the sentences edge of a User.
func (*UserClient) Update ¶
func (c *UserClient) Update() *UserUpdate
Update returns an update builder for User.
func (*UserClient) UpdateOne ¶
func (c *UserClient) UpdateOne(u *User) *UserUpdateOne
UpdateOne returns an update builder for the given entity.
func (*UserClient) UpdateOneID ¶
func (c *UserClient) UpdateOneID(id uuid.UUID) *UserUpdateOne
UpdateOneID returns an update builder for the given id.
func (*UserClient) Use ¶
func (c *UserClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.
type UserCreate ¶
type UserCreate struct {
// contains filtered or unexported fields
}
UserCreate is the builder for creating a User entity.
func (*UserCreate) AddSentenceIDs ¶
func (uc *UserCreate) AddSentenceIDs(ids ...uuid.UUID) *UserCreate
AddSentenceIDs adds the "sentences" edge to the Sentence entity by IDs.
func (*UserCreate) AddSentences ¶
func (uc *UserCreate) AddSentences(s ...*Sentence) *UserCreate
AddSentences adds the "sentences" edges to the Sentence 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) 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) SetID ¶
func (uc *UserCreate) SetID(u uuid.UUID) *UserCreate
SetID sets the "id" field.
func (*UserCreate) SetIPAddress ¶
func (uc *UserCreate) SetIPAddress(s string) *UserCreate
SetIPAddress sets the "ip_address" field.
func (*UserCreate) SetNillableID ¶
func (uc *UserCreate) SetNillableID(u *uuid.UUID) *UserCreate
SetNillableID sets the "id" field if the given value is not nil.
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.
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 {
// Sentences holds the value of the sentences edge.
Sentences []*Sentence `json:"sentences,omitempty"`
// contains filtered or unexported fields
}
UserEdges holds the relations/edges for other nodes in the graph.
func (UserEdges) SentencesOrErr ¶
SentencesOrErr returns the Sentences value or an error if the edge was not loaded in eager-loading.
type UserGroupBy ¶
type UserGroupBy struct {
// contains filtered or unexported fields
}
UserGroupBy is the group-by builder for User entities.
func (*UserGroupBy) Aggregate ¶
func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*UserGroupBy) Bool ¶
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) 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) AddSentenceIDs ¶
func (m *UserMutation) AddSentenceIDs(ids ...uuid.UUID)
AddSentenceIDs adds the "sentences" edge to the Sentence entity by ids.
func (*UserMutation) AddedEdges ¶
func (m *UserMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*UserMutation) AddedField ¶
func (m *UserMutation) AddedField(name string) (ent.Value, bool)
AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.
func (*UserMutation) AddedFields ¶
func (m *UserMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*UserMutation) AddedIDs ¶
func (m *UserMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*UserMutation) ClearEdge ¶
func (m *UserMutation) ClearEdge(name string) error
ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.
func (*UserMutation) ClearField ¶
func (m *UserMutation) ClearField(name string) error
ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.
func (*UserMutation) ClearSentences ¶
func (m *UserMutation) ClearSentences()
ClearSentences clears the "sentences" edge to the Sentence 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) ID ¶
func (m *UserMutation) ID() (id uuid.UUID, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*UserMutation) IDs ¶
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) IPAddress ¶
func (m *UserMutation) IPAddress() (r string, exists bool)
IPAddress returns the value of the "ip_address" field in the mutation.
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) OldIPAddress ¶
func (m *UserMutation) OldIPAddress(ctx context.Context) (v string, err error)
OldIPAddress returns the old "ip_address" 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) RemoveSentenceIDs ¶
func (m *UserMutation) RemoveSentenceIDs(ids ...uuid.UUID)
RemoveSentenceIDs removes the "sentences" edge to the Sentence 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) RemovedSentencesIDs ¶
func (m *UserMutation) RemovedSentencesIDs() (ids []uuid.UUID)
RemovedSentences returns the removed IDs of the "sentences" edge to the Sentence entity.
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) ResetIPAddress ¶
func (m *UserMutation) ResetIPAddress()
ResetIPAddress resets all changes to the "ip_address" field.
func (*UserMutation) ResetSentences ¶
func (m *UserMutation) ResetSentences()
ResetSentences resets all changes to the "sentences" edge.
func (*UserMutation) SentencesCleared ¶
func (m *UserMutation) SentencesCleared() bool
SentencesCleared reports if the "sentences" edge to the Sentence entity was cleared.
func (*UserMutation) SentencesIDs ¶
func (m *UserMutation) SentencesIDs() (ids []uuid.UUID)
SentencesIDs returns the "sentences" edge IDs in the mutation.
func (*UserMutation) SetField ¶
func (m *UserMutation) SetField(name string, value ent.Value) error
SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.
func (*UserMutation) SetID ¶
func (m *UserMutation) SetID(id uuid.UUID)
SetID sets the value of the id field. Note that this operation is only accepted on creation of User entities.
func (*UserMutation) SetIPAddress ¶
func (m *UserMutation) SetIPAddress(s string)
SetIPAddress sets the "ip_address" 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 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) 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 {
IPAddress string `json:"ip_address,omitempty"`
Count int `json:"count,omitempty"`
}
client.User.Query().
GroupBy(user.FieldIPAddress).
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) QuerySentences ¶
func (uq *UserQuery) QuerySentences() *SentenceQuery
QuerySentences chains the current query on the "sentences" 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 {
IPAddress string `json:"ip_address,omitempty"`
}
client.User.Query().
Select(user.FieldIPAddress).
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) WithSentences ¶
func (uq *UserQuery) WithSentences(opts ...func(*SentenceQuery)) *UserQuery
WithSentences tells the query-builder to eager-load the nodes that are connected to the "sentences" edge. The optional arguments are used to configure the query builder of the edge.
type UserSelect ¶
type UserSelect struct {
*UserQuery
// contains filtered or unexported fields
}
UserSelect is the builder for selecting fields of User entities.
func (*UserSelect) Aggregate ¶
func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect
Aggregate adds the given aggregation functions to the selector query.
func (*UserSelect) Bool ¶
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) AddSentenceIDs ¶
func (uu *UserUpdate) AddSentenceIDs(ids ...uuid.UUID) *UserUpdate
AddSentenceIDs adds the "sentences" edge to the Sentence entity by IDs.
func (*UserUpdate) AddSentences ¶
func (uu *UserUpdate) AddSentences(s ...*Sentence) *UserUpdate
AddSentences adds the "sentences" edges to the Sentence entity.
func (*UserUpdate) ClearSentences ¶
func (uu *UserUpdate) ClearSentences() *UserUpdate
ClearSentences clears all "sentences" edges to the Sentence 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) RemoveSentenceIDs ¶
func (uu *UserUpdate) RemoveSentenceIDs(ids ...uuid.UUID) *UserUpdate
RemoveSentenceIDs removes the "sentences" edge to Sentence entities by IDs.
func (*UserUpdate) RemoveSentences ¶
func (uu *UserUpdate) RemoveSentences(s ...*Sentence) *UserUpdate
RemoveSentences removes "sentences" edges to Sentence 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) SetIPAddress ¶
func (uu *UserUpdate) SetIPAddress(s string) *UserUpdate
SetIPAddress sets the "ip_address" field.
func (*UserUpdate) Where ¶
func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate
Where appends a list predicates to the UserUpdate builder.
type UserUpdateOne ¶
type UserUpdateOne struct {
// contains filtered or unexported fields
}
UserUpdateOne is the builder for updating a single User entity.
func (*UserUpdateOne) AddSentenceIDs ¶
func (uuo *UserUpdateOne) AddSentenceIDs(ids ...uuid.UUID) *UserUpdateOne
AddSentenceIDs adds the "sentences" edge to the Sentence entity by IDs.
func (*UserUpdateOne) AddSentences ¶
func (uuo *UserUpdateOne) AddSentences(s ...*Sentence) *UserUpdateOne
AddSentences adds the "sentences" edges to the Sentence entity.
func (*UserUpdateOne) ClearSentences ¶
func (uuo *UserUpdateOne) ClearSentences() *UserUpdateOne
ClearSentences clears all "sentences" edges to the Sentence 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) RemoveSentenceIDs ¶
func (uuo *UserUpdateOne) RemoveSentenceIDs(ids ...uuid.UUID) *UserUpdateOne
RemoveSentenceIDs removes the "sentences" edge to Sentence entities by IDs.
func (*UserUpdateOne) RemoveSentences ¶
func (uuo *UserUpdateOne) RemoveSentences(s ...*Sentence) *UserUpdateOne
RemoveSentences removes "sentences" edges to Sentence 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) SetIPAddress ¶
func (uuo *UserUpdateOne) SetIPAddress(s string) *UserUpdateOne
SetIPAddress sets the "ip_address" field.
func (*UserUpdateOne) Where ¶
func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne
Where appends a list predicates to the UserUpdate builder.
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.