Versions in this module Expand all Collapse all v1 v1.1.0 Apr 12, 2024 v1.0.0 Apr 6, 2024 Changes in this version + const OpCreate + const OpDelete + const OpDeleteOne + const OpUpdate + const OpUpdateOne + const TypeBook + var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction") + 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 func(*sql.Selector) string + func As(fn AggregateFunc, end string) AggregateFunc + func Count() AggregateFunc + func Max(field string) AggregateFunc + func Mean(field string) AggregateFunc + func Min(field string) AggregateFunc + func Sum(field string) AggregateFunc + type Book struct + Author string + Category string + Description string + Featured bool + ID string + ImageLink string + Summary string + Title string + func (b *Book) String() string + func (b *Book) Unwrap() *Book + func (b *Book) Update() *BookUpdateOne + func (b *Book) Value(name string) (ent.Value, error) + type BookClient struct + func NewBookClient(c config) *BookClient + func (c *BookClient) Create() *BookCreate + func (c *BookClient) CreateBulk(builders ...*BookCreate) *BookCreateBulk + func (c *BookClient) Delete() *BookDelete + func (c *BookClient) DeleteOne(b *Book) *BookDeleteOne + func (c *BookClient) DeleteOneID(id string) *BookDeleteOne + func (c *BookClient) Get(ctx context.Context, id string) (*Book, error) + func (c *BookClient) GetX(ctx context.Context, id string) *Book + func (c *BookClient) Hooks() []Hook + func (c *BookClient) Intercept(interceptors ...Interceptor) + func (c *BookClient) Interceptors() []Interceptor + func (c *BookClient) MapCreateBulk(slice any, setFunc func(*BookCreate, int)) *BookCreateBulk + func (c *BookClient) Query() *BookQuery + func (c *BookClient) Update() *BookUpdate + func (c *BookClient) UpdateOne(b *Book) *BookUpdateOne + func (c *BookClient) UpdateOneID(id string) *BookUpdateOne + func (c *BookClient) Use(hooks ...Hook) + type BookCreate struct + func (bc *BookCreate) Exec(ctx context.Context) error + func (bc *BookCreate) ExecX(ctx context.Context) + func (bc *BookCreate) Mutation() *BookMutation + func (bc *BookCreate) Save(ctx context.Context) (*Book, error) + func (bc *BookCreate) SaveX(ctx context.Context) *Book + func (bc *BookCreate) SetAuthor(s string) *BookCreate + func (bc *BookCreate) SetCategory(s string) *BookCreate + func (bc *BookCreate) SetDescription(s string) *BookCreate + func (bc *BookCreate) SetFeatured(b bool) *BookCreate + func (bc *BookCreate) SetID(s string) *BookCreate + func (bc *BookCreate) SetImageLink(s string) *BookCreate + func (bc *BookCreate) SetNillableFeatured(b *bool) *BookCreate + func (bc *BookCreate) SetSummary(s string) *BookCreate + func (bc *BookCreate) SetTitle(s string) *BookCreate + type BookCreateBulk struct + func (bcb *BookCreateBulk) Exec(ctx context.Context) error + func (bcb *BookCreateBulk) ExecX(ctx context.Context) + func (bcb *BookCreateBulk) Save(ctx context.Context) ([]*Book, error) + func (bcb *BookCreateBulk) SaveX(ctx context.Context) []*Book + type BookDelete struct + func (bd *BookDelete) Exec(ctx context.Context) (int, error) + func (bd *BookDelete) ExecX(ctx context.Context) int + func (bd *BookDelete) Where(ps ...predicate.Book) *BookDelete + type BookDeleteOne struct + func (bdo *BookDeleteOne) Exec(ctx context.Context) error + func (bdo *BookDeleteOne) ExecX(ctx context.Context) + func (bdo *BookDeleteOne) Where(ps ...predicate.Book) *BookDeleteOne + type BookGroupBy struct + func (bgb *BookGroupBy) Aggregate(fns ...AggregateFunc) *BookGroupBy + func (bgb *BookGroupBy) Scan(ctx context.Context, v any) error + func (s *BookGroupBy) Bool(ctx context.Context) (_ bool, err error) + func (s *BookGroupBy) BoolX(ctx context.Context) bool + func (s *BookGroupBy) Bools(ctx context.Context) ([]bool, error) + func (s *BookGroupBy) BoolsX(ctx context.Context) []bool + func (s *BookGroupBy) Float64(ctx context.Context) (_ float64, err error) + func (s *BookGroupBy) Float64X(ctx context.Context) float64 + func (s *BookGroupBy) Float64s(ctx context.Context) ([]float64, error) + func (s *BookGroupBy) Float64sX(ctx context.Context) []float64 + func (s *BookGroupBy) Int(ctx context.Context) (_ int, err error) + func (s *BookGroupBy) IntX(ctx context.Context) int + func (s *BookGroupBy) Ints(ctx context.Context) ([]int, error) + func (s *BookGroupBy) IntsX(ctx context.Context) []int + func (s *BookGroupBy) ScanX(ctx context.Context, v any) + func (s *BookGroupBy) String(ctx context.Context) (_ string, err error) + func (s *BookGroupBy) StringX(ctx context.Context) string + func (s *BookGroupBy) Strings(ctx context.Context) ([]string, error) + func (s *BookGroupBy) StringsX(ctx context.Context) []string + type BookMutation struct + func (m *BookMutation) AddField(name string, value ent.Value) error + func (m *BookMutation) AddedEdges() []string + func (m *BookMutation) AddedField(name string) (ent.Value, bool) + func (m *BookMutation) AddedFields() []string + func (m *BookMutation) AddedIDs(name string) []ent.Value + func (m *BookMutation) Author() (r string, exists bool) + func (m *BookMutation) Category() (r string, exists bool) + func (m *BookMutation) ClearEdge(name string) error + func (m *BookMutation) ClearField(name string) error + func (m *BookMutation) ClearedEdges() []string + func (m *BookMutation) ClearedFields() []string + func (m *BookMutation) Description() (r string, exists bool) + func (m *BookMutation) EdgeCleared(name string) bool + func (m *BookMutation) Featured() (r bool, exists bool) + func (m *BookMutation) Field(name string) (ent.Value, bool) + func (m *BookMutation) FieldCleared(name string) bool + func (m *BookMutation) Fields() []string + func (m *BookMutation) ID() (id string, exists bool) + func (m *BookMutation) IDs(ctx context.Context) ([]string, error) + func (m *BookMutation) ImageLink() (r string, exists bool) + func (m *BookMutation) OldAuthor(ctx context.Context) (v string, err error) + func (m *BookMutation) OldCategory(ctx context.Context) (v string, err error) + func (m *BookMutation) OldDescription(ctx context.Context) (v string, err error) + func (m *BookMutation) OldFeatured(ctx context.Context) (v bool, err error) + func (m *BookMutation) OldField(ctx context.Context, name string) (ent.Value, error) + func (m *BookMutation) OldImageLink(ctx context.Context) (v string, err error) + func (m *BookMutation) OldSummary(ctx context.Context) (v string, err error) + func (m *BookMutation) OldTitle(ctx context.Context) (v string, err error) + func (m *BookMutation) Op() Op + func (m *BookMutation) RemovedEdges() []string + func (m *BookMutation) RemovedIDs(name string) []ent.Value + func (m *BookMutation) ResetAuthor() + func (m *BookMutation) ResetCategory() + func (m *BookMutation) ResetDescription() + func (m *BookMutation) ResetEdge(name string) error + func (m *BookMutation) ResetFeatured() + func (m *BookMutation) ResetField(name string) error + func (m *BookMutation) ResetImageLink() + func (m *BookMutation) ResetSummary() + func (m *BookMutation) ResetTitle() + func (m *BookMutation) SetAuthor(s string) + func (m *BookMutation) SetCategory(s string) + func (m *BookMutation) SetDescription(s string) + func (m *BookMutation) SetFeatured(b bool) + func (m *BookMutation) SetField(name string, value ent.Value) error + func (m *BookMutation) SetID(id string) + func (m *BookMutation) SetImageLink(s string) + func (m *BookMutation) SetOp(op Op) + func (m *BookMutation) SetSummary(s string) + func (m *BookMutation) SetTitle(s string) + func (m *BookMutation) Summary() (r string, exists bool) + func (m *BookMutation) Title() (r string, exists bool) + func (m *BookMutation) Type() string + func (m *BookMutation) Where(ps ...predicate.Book) + func (m *BookMutation) WhereP(ps ...func(*sql.Selector)) + func (m BookMutation) Client() *Client + func (m BookMutation) Tx() (*Tx, error) + type BookQuery struct + func (bq *BookQuery) Aggregate(fns ...AggregateFunc) *BookSelect + func (bq *BookQuery) All(ctx context.Context) ([]*Book, error) + func (bq *BookQuery) AllX(ctx context.Context) []*Book + func (bq *BookQuery) Clone() *BookQuery + func (bq *BookQuery) Count(ctx context.Context) (int, error) + func (bq *BookQuery) CountX(ctx context.Context) int + func (bq *BookQuery) Exist(ctx context.Context) (bool, error) + func (bq *BookQuery) ExistX(ctx context.Context) bool + func (bq *BookQuery) First(ctx context.Context) (*Book, error) + func (bq *BookQuery) FirstID(ctx context.Context) (id string, err error) + func (bq *BookQuery) FirstIDX(ctx context.Context) string + func (bq *BookQuery) FirstX(ctx context.Context) *Book + func (bq *BookQuery) GroupBy(field string, fields ...string) *BookGroupBy + func (bq *BookQuery) IDs(ctx context.Context) (ids []string, err error) + func (bq *BookQuery) IDsX(ctx context.Context) []string + func (bq *BookQuery) Limit(limit int) *BookQuery + func (bq *BookQuery) Offset(offset int) *BookQuery + func (bq *BookQuery) Only(ctx context.Context) (*Book, error) + func (bq *BookQuery) OnlyID(ctx context.Context) (id string, err error) + func (bq *BookQuery) OnlyIDX(ctx context.Context) string + func (bq *BookQuery) OnlyX(ctx context.Context) *Book + func (bq *BookQuery) Order(o ...book.OrderOption) *BookQuery + func (bq *BookQuery) Select(fields ...string) *BookSelect + func (bq *BookQuery) Unique(unique bool) *BookQuery + func (bq *BookQuery) Where(ps ...predicate.Book) *BookQuery + type BookSelect struct + func (bs *BookSelect) Aggregate(fns ...AggregateFunc) *BookSelect + func (bs *BookSelect) Scan(ctx context.Context, v any) error + func (s *BookSelect) Bool(ctx context.Context) (_ bool, err error) + func (s *BookSelect) BoolX(ctx context.Context) bool + func (s *BookSelect) Bools(ctx context.Context) ([]bool, error) + func (s *BookSelect) BoolsX(ctx context.Context) []bool + func (s *BookSelect) Float64(ctx context.Context) (_ float64, err error) + func (s *BookSelect) Float64X(ctx context.Context) float64 + func (s *BookSelect) Float64s(ctx context.Context) ([]float64, error) + func (s *BookSelect) Float64sX(ctx context.Context) []float64 + func (s *BookSelect) Int(ctx context.Context) (_ int, err error) + func (s *BookSelect) IntX(ctx context.Context) int + func (s *BookSelect) Ints(ctx context.Context) ([]int, error) + func (s *BookSelect) IntsX(ctx context.Context) []int + func (s *BookSelect) ScanX(ctx context.Context, v any) + func (s *BookSelect) String(ctx context.Context) (_ string, err error) + func (s *BookSelect) StringX(ctx context.Context) string + func (s *BookSelect) Strings(ctx context.Context) ([]string, error) + func (s *BookSelect) StringsX(ctx context.Context) []string + type BookUpdate struct + func (bu *BookUpdate) Exec(ctx context.Context) error + func (bu *BookUpdate) ExecX(ctx context.Context) + func (bu *BookUpdate) Mutation() *BookMutation + func (bu *BookUpdate) Save(ctx context.Context) (int, error) + func (bu *BookUpdate) SaveX(ctx context.Context) int + func (bu *BookUpdate) SetAuthor(s string) *BookUpdate + func (bu *BookUpdate) SetCategory(s string) *BookUpdate + func (bu *BookUpdate) SetDescription(s string) *BookUpdate + func (bu *BookUpdate) SetFeatured(b bool) *BookUpdate + func (bu *BookUpdate) SetImageLink(s string) *BookUpdate + func (bu *BookUpdate) SetNillableAuthor(s *string) *BookUpdate + func (bu *BookUpdate) SetNillableCategory(s *string) *BookUpdate + func (bu *BookUpdate) SetNillableDescription(s *string) *BookUpdate + func (bu *BookUpdate) SetNillableFeatured(b *bool) *BookUpdate + func (bu *BookUpdate) SetNillableImageLink(s *string) *BookUpdate + func (bu *BookUpdate) SetNillableSummary(s *string) *BookUpdate + func (bu *BookUpdate) SetNillableTitle(s *string) *BookUpdate + func (bu *BookUpdate) SetSummary(s string) *BookUpdate + func (bu *BookUpdate) SetTitle(s string) *BookUpdate + func (bu *BookUpdate) Where(ps ...predicate.Book) *BookUpdate + type BookUpdateOne struct + func (buo *BookUpdateOne) Exec(ctx context.Context) error + func (buo *BookUpdateOne) ExecX(ctx context.Context) + func (buo *BookUpdateOne) Mutation() *BookMutation + func (buo *BookUpdateOne) Save(ctx context.Context) (*Book, error) + func (buo *BookUpdateOne) SaveX(ctx context.Context) *Book + func (buo *BookUpdateOne) Select(field string, fields ...string) *BookUpdateOne + func (buo *BookUpdateOne) SetAuthor(s string) *BookUpdateOne + func (buo *BookUpdateOne) SetCategory(s string) *BookUpdateOne + func (buo *BookUpdateOne) SetDescription(s string) *BookUpdateOne + func (buo *BookUpdateOne) SetFeatured(b bool) *BookUpdateOne + func (buo *BookUpdateOne) SetImageLink(s string) *BookUpdateOne + func (buo *BookUpdateOne) SetNillableAuthor(s *string) *BookUpdateOne + func (buo *BookUpdateOne) SetNillableCategory(s *string) *BookUpdateOne + func (buo *BookUpdateOne) SetNillableDescription(s *string) *BookUpdateOne + func (buo *BookUpdateOne) SetNillableFeatured(b *bool) *BookUpdateOne + func (buo *BookUpdateOne) SetNillableImageLink(s *string) *BookUpdateOne + func (buo *BookUpdateOne) SetNillableSummary(s *string) *BookUpdateOne + func (buo *BookUpdateOne) SetNillableTitle(s *string) *BookUpdateOne + func (buo *BookUpdateOne) SetSummary(s string) *BookUpdateOne + func (buo *BookUpdateOne) SetTitle(s string) *BookUpdateOne + func (buo *BookUpdateOne) Where(ps ...predicate.Book) *BookUpdateOne + type Books []*Book + type Client struct + Book *BookClient + Schema *migrate.Schema + func FromContext(ctx context.Context) *Client + func NewClient(opts ...Option) *Client + func Open(driverName, dataSourceName string, options ...Option) (*Client, error) + 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 func(context.Context, *Tx) error + func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error + type CommitHook func(Committer) Committer + type Committer interface + Commit func(context.Context, *Tx) error + type ConstraintError struct + func (e *ConstraintError) Unwrap() error + func (e ConstraintError) Error() string + type Hook = ent.Hook + type InterceptFunc = ent.InterceptFunc + type Interceptor = ent.Interceptor + type MutateFunc = ent.MutateFunc + type Mutation = ent.Mutation + type Mutator = ent.Mutator + type NotFoundError struct + func (e *NotFoundError) Error() string + type NotLoadedError struct + func (e *NotLoadedError) Error() string + type NotSingularError struct + func (e *NotSingularError) Error() string + type Op = ent.Op + type Option func(*config) + func Debug() Option + func Driver(driver dialect.Driver) Option + func Log(fn func(...any)) Option + type OrderFunc func(*sql.Selector) + type Policy = ent.Policy + type Querier = ent.Querier + type QuerierFunc = ent.QuerierFunc + type Query = ent.Query + type QueryContext = ent.QueryContext + type RollbackFunc func(context.Context, *Tx) error + func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error + type RollbackHook func(Rollbacker) Rollbacker + type Rollbacker interface + Rollback func(context.Context, *Tx) error + type TraverseFunc = ent.TraverseFunc + type Traverser = ent.Traverser + type Tx struct + Book *BookClient + func TxFromContext(ctx context.Context) *Tx + func (tx *Tx) Client() *Client + func (tx *Tx) Commit() error + func (tx *Tx) OnCommit(f CommitHook) + func (tx *Tx) OnRollback(f RollbackHook) + func (tx *Tx) Rollback() error + type ValidationError struct + Name string + func (e *ValidationError) Error() string + func (e *ValidationError) Unwrap() error + type Value = ent.Value