Documentation
¶
Index ¶
- Constants
- 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 Bookmark
- type BookmarkClient
- func (c *BookmarkClient) Create() *BookmarkCreate
- func (c *BookmarkClient) CreateBulk(builders ...*BookmarkCreate) *BookmarkCreateBulk
- func (c *BookmarkClient) Delete() *BookmarkDelete
- func (c *BookmarkClient) DeleteOne(b *Bookmark) *BookmarkDeleteOne
- func (c *BookmarkClient) DeleteOneID(id uuid.UUID) *BookmarkDeleteOne
- func (c *BookmarkClient) Get(ctx context.Context, id uuid.UUID) (*Bookmark, error)
- func (c *BookmarkClient) GetX(ctx context.Context, id uuid.UUID) *Bookmark
- func (c *BookmarkClient) Hooks() []Hook
- func (c *BookmarkClient) Query() *BookmarkQuery
- func (c *BookmarkClient) Update() *BookmarkUpdate
- func (c *BookmarkClient) UpdateOne(b *Bookmark) *BookmarkUpdateOne
- func (c *BookmarkClient) UpdateOneID(id uuid.UUID) *BookmarkUpdateOne
- func (c *BookmarkClient) Use(hooks ...Hook)
- type BookmarkCreate
- func (bc *BookmarkCreate) Exec(ctx context.Context) error
- func (bc *BookmarkCreate) ExecX(ctx context.Context)
- func (bc *BookmarkCreate) Mutation() *BookmarkMutation
- func (bc *BookmarkCreate) Save(ctx context.Context) (*Bookmark, error)
- func (bc *BookmarkCreate) SaveX(ctx context.Context) *Bookmark
- func (bc *BookmarkCreate) SetBookmarks(s string) *BookmarkCreate
- func (bc *BookmarkCreate) SetCreated(t time.Time) *BookmarkCreate
- func (bc *BookmarkCreate) SetDeleted(t time.Time) *BookmarkCreate
- func (bc *BookmarkCreate) SetID(u uuid.UUID) *BookmarkCreate
- func (bc *BookmarkCreate) SetLastUpdated(t time.Time) *BookmarkCreate
- func (bc *BookmarkCreate) SetNillableCreated(t *time.Time) *BookmarkCreate
- func (bc *BookmarkCreate) SetNillableDeleted(t *time.Time) *BookmarkCreate
- func (bc *BookmarkCreate) SetNillableID(u *uuid.UUID) *BookmarkCreate
- func (bc *BookmarkCreate) SetNillableLastUpdated(t *time.Time) *BookmarkCreate
- func (bc *BookmarkCreate) SetNillableVersion(s *string) *BookmarkCreate
- func (bc *BookmarkCreate) SetVersion(s string) *BookmarkCreate
- type BookmarkCreateBulk
- type BookmarkDelete
- type BookmarkDeleteOne
- type BookmarkGroupBy
- func (bgb *BookmarkGroupBy) Aggregate(fns ...AggregateFunc) *BookmarkGroupBy
- func (s *BookmarkGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *BookmarkGroupBy) BoolX(ctx context.Context) bool
- func (s *BookmarkGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *BookmarkGroupBy) BoolsX(ctx context.Context) []bool
- func (s *BookmarkGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *BookmarkGroupBy) Float64X(ctx context.Context) float64
- func (s *BookmarkGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *BookmarkGroupBy) Float64sX(ctx context.Context) []float64
- func (s *BookmarkGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *BookmarkGroupBy) IntX(ctx context.Context) int
- func (s *BookmarkGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *BookmarkGroupBy) IntsX(ctx context.Context) []int
- func (bgb *BookmarkGroupBy) Scan(ctx context.Context, v any) error
- func (s *BookmarkGroupBy) ScanX(ctx context.Context, v any)
- func (s *BookmarkGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *BookmarkGroupBy) StringX(ctx context.Context) string
- func (s *BookmarkGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *BookmarkGroupBy) StringsX(ctx context.Context) []string
- type BookmarkMutation
- func (m *BookmarkMutation) AddField(name string, value ent.Value) error
- func (m *BookmarkMutation) AddedEdges() []string
- func (m *BookmarkMutation) AddedField(name string) (ent.Value, bool)
- func (m *BookmarkMutation) AddedFields() []string
- func (m *BookmarkMutation) AddedIDs(name string) []ent.Value
- func (m *BookmarkMutation) Bookmarks() (r string, exists bool)
- func (m *BookmarkMutation) ClearDeleted()
- func (m *BookmarkMutation) ClearEdge(name string) error
- func (m *BookmarkMutation) ClearField(name string) error
- func (m *BookmarkMutation) ClearedEdges() []string
- func (m *BookmarkMutation) ClearedFields() []string
- func (m BookmarkMutation) Client() *Client
- func (m *BookmarkMutation) Created() (r time.Time, exists bool)
- func (m *BookmarkMutation) Deleted() (r time.Time, exists bool)
- func (m *BookmarkMutation) DeletedCleared() bool
- func (m *BookmarkMutation) EdgeCleared(name string) bool
- func (m *BookmarkMutation) Field(name string) (ent.Value, bool)
- func (m *BookmarkMutation) FieldCleared(name string) bool
- func (m *BookmarkMutation) Fields() []string
- func (m *BookmarkMutation) ID() (id uuid.UUID, exists bool)
- func (m *BookmarkMutation) IDs(ctx context.Context) ([]uuid.UUID, error)
- func (m *BookmarkMutation) LastUpdated() (r time.Time, exists bool)
- func (m *BookmarkMutation) OldBookmarks(ctx context.Context) (v string, err error)
- func (m *BookmarkMutation) OldCreated(ctx context.Context) (v time.Time, err error)
- func (m *BookmarkMutation) OldDeleted(ctx context.Context) (v *time.Time, err error)
- func (m *BookmarkMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *BookmarkMutation) OldLastUpdated(ctx context.Context) (v time.Time, err error)
- func (m *BookmarkMutation) OldVersion(ctx context.Context) (v string, err error)
- func (m *BookmarkMutation) Op() Op
- func (m *BookmarkMutation) RemovedEdges() []string
- func (m *BookmarkMutation) RemovedIDs(name string) []ent.Value
- func (m *BookmarkMutation) ResetBookmarks()
- func (m *BookmarkMutation) ResetCreated()
- func (m *BookmarkMutation) ResetDeleted()
- func (m *BookmarkMutation) ResetEdge(name string) error
- func (m *BookmarkMutation) ResetField(name string) error
- func (m *BookmarkMutation) ResetLastUpdated()
- func (m *BookmarkMutation) ResetVersion()
- func (m *BookmarkMutation) SetBookmarks(s string)
- func (m *BookmarkMutation) SetCreated(t time.Time)
- func (m *BookmarkMutation) SetDeleted(t time.Time)
- func (m *BookmarkMutation) SetField(name string, value ent.Value) error
- func (m *BookmarkMutation) SetID(id uuid.UUID)
- func (m *BookmarkMutation) SetLastUpdated(t time.Time)
- func (m *BookmarkMutation) SetVersion(s string)
- func (m BookmarkMutation) Tx() (*Tx, error)
- func (m *BookmarkMutation) Type() string
- func (m *BookmarkMutation) Version() (r string, exists bool)
- func (m *BookmarkMutation) Where(ps ...predicate.Bookmark)
- type BookmarkQuery
- func (bq *BookmarkQuery) Aggregate(fns ...AggregateFunc) *BookmarkSelect
- func (bq *BookmarkQuery) All(ctx context.Context) ([]*Bookmark, error)
- func (bq *BookmarkQuery) AllX(ctx context.Context) []*Bookmark
- func (bq *BookmarkQuery) Clone() *BookmarkQuery
- func (bq *BookmarkQuery) Count(ctx context.Context) (int, error)
- func (bq *BookmarkQuery) CountX(ctx context.Context) int
- func (bq *BookmarkQuery) Exist(ctx context.Context) (bool, error)
- func (bq *BookmarkQuery) ExistX(ctx context.Context) bool
- func (bq *BookmarkQuery) First(ctx context.Context) (*Bookmark, error)
- func (bq *BookmarkQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)
- func (bq *BookmarkQuery) FirstIDX(ctx context.Context) uuid.UUID
- func (bq *BookmarkQuery) FirstX(ctx context.Context) *Bookmark
- func (bq *BookmarkQuery) GroupBy(field string, fields ...string) *BookmarkGroupBy
- func (bq *BookmarkQuery) IDs(ctx context.Context) ([]uuid.UUID, error)
- func (bq *BookmarkQuery) IDsX(ctx context.Context) []uuid.UUID
- func (bq *BookmarkQuery) Limit(limit int) *BookmarkQuery
- func (bq *BookmarkQuery) Offset(offset int) *BookmarkQuery
- func (bq *BookmarkQuery) Only(ctx context.Context) (*Bookmark, error)
- func (bq *BookmarkQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)
- func (bq *BookmarkQuery) OnlyIDX(ctx context.Context) uuid.UUID
- func (bq *BookmarkQuery) OnlyX(ctx context.Context) *Bookmark
- func (bq *BookmarkQuery) Order(o ...OrderFunc) *BookmarkQuery
- func (bq *BookmarkQuery) Select(fields ...string) *BookmarkSelect
- func (bq *BookmarkQuery) Unique(unique bool) *BookmarkQuery
- func (bq *BookmarkQuery) Where(ps ...predicate.Bookmark) *BookmarkQuery
- type BookmarkSelect
- func (bs *BookmarkSelect) Aggregate(fns ...AggregateFunc) *BookmarkSelect
- func (s *BookmarkSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *BookmarkSelect) BoolX(ctx context.Context) bool
- func (s *BookmarkSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *BookmarkSelect) BoolsX(ctx context.Context) []bool
- func (s *BookmarkSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *BookmarkSelect) Float64X(ctx context.Context) float64
- func (s *BookmarkSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *BookmarkSelect) Float64sX(ctx context.Context) []float64
- func (s *BookmarkSelect) Int(ctx context.Context) (_ int, err error)
- func (s *BookmarkSelect) IntX(ctx context.Context) int
- func (s *BookmarkSelect) Ints(ctx context.Context) ([]int, error)
- func (s *BookmarkSelect) IntsX(ctx context.Context) []int
- func (bs *BookmarkSelect) Scan(ctx context.Context, v any) error
- func (s *BookmarkSelect) ScanX(ctx context.Context, v any)
- func (s *BookmarkSelect) String(ctx context.Context) (_ string, err error)
- func (s *BookmarkSelect) StringX(ctx context.Context) string
- func (s *BookmarkSelect) Strings(ctx context.Context) ([]string, error)
- func (s *BookmarkSelect) StringsX(ctx context.Context) []string
- type BookmarkUpdate
- func (bu *BookmarkUpdate) ClearDeleted() *BookmarkUpdate
- func (bu *BookmarkUpdate) Exec(ctx context.Context) error
- func (bu *BookmarkUpdate) ExecX(ctx context.Context)
- func (bu *BookmarkUpdate) Mutation() *BookmarkMutation
- func (bu *BookmarkUpdate) Save(ctx context.Context) (int, error)
- func (bu *BookmarkUpdate) SaveX(ctx context.Context) int
- func (bu *BookmarkUpdate) SetBookmarks(s string) *BookmarkUpdate
- func (bu *BookmarkUpdate) SetCreated(t time.Time) *BookmarkUpdate
- func (bu *BookmarkUpdate) SetDeleted(t time.Time) *BookmarkUpdate
- func (bu *BookmarkUpdate) SetLastUpdated(t time.Time) *BookmarkUpdate
- func (bu *BookmarkUpdate) SetNillableCreated(t *time.Time) *BookmarkUpdate
- func (bu *BookmarkUpdate) SetNillableDeleted(t *time.Time) *BookmarkUpdate
- func (bu *BookmarkUpdate) SetNillableVersion(s *string) *BookmarkUpdate
- func (bu *BookmarkUpdate) SetVersion(s string) *BookmarkUpdate
- func (bu *BookmarkUpdate) Where(ps ...predicate.Bookmark) *BookmarkUpdate
- type BookmarkUpdateOne
- func (buo *BookmarkUpdateOne) ClearDeleted() *BookmarkUpdateOne
- func (buo *BookmarkUpdateOne) Exec(ctx context.Context) error
- func (buo *BookmarkUpdateOne) ExecX(ctx context.Context)
- func (buo *BookmarkUpdateOne) Mutation() *BookmarkMutation
- func (buo *BookmarkUpdateOne) Save(ctx context.Context) (*Bookmark, error)
- func (buo *BookmarkUpdateOne) SaveX(ctx context.Context) *Bookmark
- func (buo *BookmarkUpdateOne) Select(field string, fields ...string) *BookmarkUpdateOne
- func (buo *BookmarkUpdateOne) SetBookmarks(s string) *BookmarkUpdateOne
- func (buo *BookmarkUpdateOne) SetCreated(t time.Time) *BookmarkUpdateOne
- func (buo *BookmarkUpdateOne) SetDeleted(t time.Time) *BookmarkUpdateOne
- func (buo *BookmarkUpdateOne) SetLastUpdated(t time.Time) *BookmarkUpdateOne
- func (buo *BookmarkUpdateOne) SetNillableCreated(t *time.Time) *BookmarkUpdateOne
- func (buo *BookmarkUpdateOne) SetNillableDeleted(t *time.Time) *BookmarkUpdateOne
- func (buo *BookmarkUpdateOne) SetNillableVersion(s *string) *BookmarkUpdateOne
- func (buo *BookmarkUpdateOne) SetVersion(s string) *BookmarkUpdateOne
- type Bookmarks
- type Client
- type CommitFunc
- type CommitHook
- type Committer
- type ConstraintError
- type Hook
- type MutateFunc
- type Mutation
- type Mutator
- type NotFoundError
- type NotLoadedError
- type NotSingularError
- type Op
- type Option
- type OrderFunc
- type Policy
- type Query
- type RollbackFunc
- type RollbackHook
- type Rollbacker
- type Tx
- 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. TypeBookmark = "Bookmark" )
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 Bookmark ¶
type Bookmark struct { // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // Bookmarks holds the value of the "bookmarks" field. Bookmarks string `json:"bookmarks,omitempty"` // Version holds the value of the "version" field. Version string `json:"version,omitempty"` // Created holds the value of the "created" field. Created time.Time `json:"created,omitempty"` // LastUpdated holds the value of the "lastUpdated" field. LastUpdated time.Time `json:"lastUpdated,omitempty"` // Deleted holds the value of the "deleted" field. Deleted *time.Time `json:"deleted,omitempty"` // contains filtered or unexported fields }
Bookmark is the model entity for the Bookmark schema.
func (*Bookmark) Unwrap ¶
Unwrap unwraps the Bookmark 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 (*Bookmark) Update ¶
func (b *Bookmark) Update() *BookmarkUpdateOne
Update returns a builder for updating this Bookmark. Note that you need to call Bookmark.Unwrap() before calling this method if this Bookmark was returned from a transaction, and the transaction was committed or rolled back.
type BookmarkClient ¶
type BookmarkClient struct {
// contains filtered or unexported fields
}
BookmarkClient is a client for the Bookmark schema.
func NewBookmarkClient ¶
func NewBookmarkClient(c config) *BookmarkClient
NewBookmarkClient returns a client for the Bookmark from the given config.
func (*BookmarkClient) Create ¶
func (c *BookmarkClient) Create() *BookmarkCreate
Create returns a builder for creating a Bookmark entity.
func (*BookmarkClient) CreateBulk ¶
func (c *BookmarkClient) CreateBulk(builders ...*BookmarkCreate) *BookmarkCreateBulk
CreateBulk returns a builder for creating a bulk of Bookmark entities.
func (*BookmarkClient) Delete ¶
func (c *BookmarkClient) Delete() *BookmarkDelete
Delete returns a delete builder for Bookmark.
func (*BookmarkClient) DeleteOne ¶
func (c *BookmarkClient) DeleteOne(b *Bookmark) *BookmarkDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*BookmarkClient) DeleteOneID ¶
func (c *BookmarkClient) DeleteOneID(id uuid.UUID) *BookmarkDeleteOne
DeleteOneID returns a builder for deleting the given entity by its id.
func (*BookmarkClient) Hooks ¶
func (c *BookmarkClient) Hooks() []Hook
Hooks returns the client hooks.
func (*BookmarkClient) Query ¶
func (c *BookmarkClient) Query() *BookmarkQuery
Query returns a query builder for Bookmark.
func (*BookmarkClient) Update ¶
func (c *BookmarkClient) Update() *BookmarkUpdate
Update returns an update builder for Bookmark.
func (*BookmarkClient) UpdateOne ¶
func (c *BookmarkClient) UpdateOne(b *Bookmark) *BookmarkUpdateOne
UpdateOne returns an update builder for the given entity.
func (*BookmarkClient) UpdateOneID ¶
func (c *BookmarkClient) UpdateOneID(id uuid.UUID) *BookmarkUpdateOne
UpdateOneID returns an update builder for the given id.
func (*BookmarkClient) Use ¶
func (c *BookmarkClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `bookmark.Hooks(f(g(h())))`.
type BookmarkCreate ¶
type BookmarkCreate struct {
// contains filtered or unexported fields
}
BookmarkCreate is the builder for creating a Bookmark entity.
func (*BookmarkCreate) Exec ¶
func (bc *BookmarkCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*BookmarkCreate) ExecX ¶
func (bc *BookmarkCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*BookmarkCreate) Mutation ¶
func (bc *BookmarkCreate) Mutation() *BookmarkMutation
Mutation returns the BookmarkMutation object of the builder.
func (*BookmarkCreate) Save ¶
func (bc *BookmarkCreate) Save(ctx context.Context) (*Bookmark, error)
Save creates the Bookmark in the database.
func (*BookmarkCreate) SaveX ¶
func (bc *BookmarkCreate) SaveX(ctx context.Context) *Bookmark
SaveX calls Save and panics if Save returns an error.
func (*BookmarkCreate) SetBookmarks ¶
func (bc *BookmarkCreate) SetBookmarks(s string) *BookmarkCreate
SetBookmarks sets the "bookmarks" field.
func (*BookmarkCreate) SetCreated ¶
func (bc *BookmarkCreate) SetCreated(t time.Time) *BookmarkCreate
SetCreated sets the "created" field.
func (*BookmarkCreate) SetDeleted ¶
func (bc *BookmarkCreate) SetDeleted(t time.Time) *BookmarkCreate
SetDeleted sets the "deleted" field.
func (*BookmarkCreate) SetID ¶
func (bc *BookmarkCreate) SetID(u uuid.UUID) *BookmarkCreate
SetID sets the "id" field.
func (*BookmarkCreate) SetLastUpdated ¶
func (bc *BookmarkCreate) SetLastUpdated(t time.Time) *BookmarkCreate
SetLastUpdated sets the "lastUpdated" field.
func (*BookmarkCreate) SetNillableCreated ¶
func (bc *BookmarkCreate) SetNillableCreated(t *time.Time) *BookmarkCreate
SetNillableCreated sets the "created" field if the given value is not nil.
func (*BookmarkCreate) SetNillableDeleted ¶
func (bc *BookmarkCreate) SetNillableDeleted(t *time.Time) *BookmarkCreate
SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (*BookmarkCreate) SetNillableID ¶
func (bc *BookmarkCreate) SetNillableID(u *uuid.UUID) *BookmarkCreate
SetNillableID sets the "id" field if the given value is not nil.
func (*BookmarkCreate) SetNillableLastUpdated ¶
func (bc *BookmarkCreate) SetNillableLastUpdated(t *time.Time) *BookmarkCreate
SetNillableLastUpdated sets the "lastUpdated" field if the given value is not nil.
func (*BookmarkCreate) SetNillableVersion ¶
func (bc *BookmarkCreate) SetNillableVersion(s *string) *BookmarkCreate
SetNillableVersion sets the "version" field if the given value is not nil.
func (*BookmarkCreate) SetVersion ¶
func (bc *BookmarkCreate) SetVersion(s string) *BookmarkCreate
SetVersion sets the "version" field.
type BookmarkCreateBulk ¶
type BookmarkCreateBulk struct {
// contains filtered or unexported fields
}
BookmarkCreateBulk is the builder for creating many Bookmark entities in bulk.
func (*BookmarkCreateBulk) Exec ¶
func (bcb *BookmarkCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*BookmarkCreateBulk) ExecX ¶
func (bcb *BookmarkCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type BookmarkDelete ¶
type BookmarkDelete struct {
// contains filtered or unexported fields
}
BookmarkDelete is the builder for deleting a Bookmark entity.
func (*BookmarkDelete) Exec ¶
func (bd *BookmarkDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*BookmarkDelete) ExecX ¶
func (bd *BookmarkDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*BookmarkDelete) Where ¶
func (bd *BookmarkDelete) Where(ps ...predicate.Bookmark) *BookmarkDelete
Where appends a list predicates to the BookmarkDelete builder.
type BookmarkDeleteOne ¶
type BookmarkDeleteOne struct {
// contains filtered or unexported fields
}
BookmarkDeleteOne is the builder for deleting a single Bookmark entity.
func (*BookmarkDeleteOne) Exec ¶
func (bdo *BookmarkDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*BookmarkDeleteOne) ExecX ¶
func (bdo *BookmarkDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type BookmarkGroupBy ¶
type BookmarkGroupBy struct {
// contains filtered or unexported fields
}
BookmarkGroupBy is the group-by builder for Bookmark entities.
func (*BookmarkGroupBy) Aggregate ¶
func (bgb *BookmarkGroupBy) Aggregate(fns ...AggregateFunc) *BookmarkGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*BookmarkGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*BookmarkGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*BookmarkGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*BookmarkGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*BookmarkGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*BookmarkGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*BookmarkGroupBy) Scan ¶
func (bgb *BookmarkGroupBy) Scan(ctx context.Context, v any) error
Scan applies the group-by query and scans the result into the given value.
func (*BookmarkGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type BookmarkMutation ¶
type BookmarkMutation struct {
// contains filtered or unexported fields
}
BookmarkMutation represents an operation that mutates the Bookmark nodes in the graph.
func (*BookmarkMutation) AddField ¶
func (m *BookmarkMutation) 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 (*BookmarkMutation) AddedEdges ¶
func (m *BookmarkMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*BookmarkMutation) AddedField ¶
func (m *BookmarkMutation) 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 (*BookmarkMutation) AddedFields ¶
func (m *BookmarkMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*BookmarkMutation) AddedIDs ¶
func (m *BookmarkMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*BookmarkMutation) Bookmarks ¶
func (m *BookmarkMutation) Bookmarks() (r string, exists bool)
Bookmarks returns the value of the "bookmarks" field in the mutation.
func (*BookmarkMutation) ClearDeleted ¶
func (m *BookmarkMutation) ClearDeleted()
ClearDeleted clears the value of the "deleted" field.
func (*BookmarkMutation) ClearEdge ¶
func (m *BookmarkMutation) 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 (*BookmarkMutation) ClearField ¶
func (m *BookmarkMutation) 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 (*BookmarkMutation) ClearedEdges ¶
func (m *BookmarkMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*BookmarkMutation) ClearedFields ¶
func (m *BookmarkMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (BookmarkMutation) Client ¶
func (m BookmarkMutation) 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 (*BookmarkMutation) Created ¶
func (m *BookmarkMutation) Created() (r time.Time, exists bool)
Created returns the value of the "created" field in the mutation.
func (*BookmarkMutation) Deleted ¶
func (m *BookmarkMutation) Deleted() (r time.Time, exists bool)
Deleted returns the value of the "deleted" field in the mutation.
func (*BookmarkMutation) DeletedCleared ¶
func (m *BookmarkMutation) DeletedCleared() bool
DeletedCleared returns if the "deleted" field was cleared in this mutation.
func (*BookmarkMutation) EdgeCleared ¶
func (m *BookmarkMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*BookmarkMutation) Field ¶
func (m *BookmarkMutation) 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 (*BookmarkMutation) FieldCleared ¶
func (m *BookmarkMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*BookmarkMutation) Fields ¶
func (m *BookmarkMutation) 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 (*BookmarkMutation) ID ¶
func (m *BookmarkMutation) 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 (*BookmarkMutation) 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 (*BookmarkMutation) LastUpdated ¶
func (m *BookmarkMutation) LastUpdated() (r time.Time, exists bool)
LastUpdated returns the value of the "lastUpdated" field in the mutation.
func (*BookmarkMutation) OldBookmarks ¶
func (m *BookmarkMutation) OldBookmarks(ctx context.Context) (v string, err error)
OldBookmarks returns the old "bookmarks" field's value of the Bookmark entity. If the Bookmark 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 (*BookmarkMutation) OldCreated ¶
OldCreated returns the old "created" field's value of the Bookmark entity. If the Bookmark 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 (*BookmarkMutation) OldDeleted ¶
OldDeleted returns the old "deleted" field's value of the Bookmark entity. If the Bookmark 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 (*BookmarkMutation) 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 (*BookmarkMutation) OldLastUpdated ¶
OldLastUpdated returns the old "lastUpdated" field's value of the Bookmark entity. If the Bookmark 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 (*BookmarkMutation) OldVersion ¶
func (m *BookmarkMutation) OldVersion(ctx context.Context) (v string, err error)
OldVersion returns the old "version" field's value of the Bookmark entity. If the Bookmark 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 (*BookmarkMutation) RemovedEdges ¶
func (m *BookmarkMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*BookmarkMutation) RemovedIDs ¶
func (m *BookmarkMutation) 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 (*BookmarkMutation) ResetBookmarks ¶
func (m *BookmarkMutation) ResetBookmarks()
ResetBookmarks resets all changes to the "bookmarks" field.
func (*BookmarkMutation) ResetCreated ¶
func (m *BookmarkMutation) ResetCreated()
ResetCreated resets all changes to the "created" field.
func (*BookmarkMutation) ResetDeleted ¶
func (m *BookmarkMutation) ResetDeleted()
ResetDeleted resets all changes to the "deleted" field.
func (*BookmarkMutation) ResetEdge ¶
func (m *BookmarkMutation) 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 (*BookmarkMutation) ResetField ¶
func (m *BookmarkMutation) 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 (*BookmarkMutation) ResetLastUpdated ¶
func (m *BookmarkMutation) ResetLastUpdated()
ResetLastUpdated resets all changes to the "lastUpdated" field.
func (*BookmarkMutation) ResetVersion ¶
func (m *BookmarkMutation) ResetVersion()
ResetVersion resets all changes to the "version" field.
func (*BookmarkMutation) SetBookmarks ¶
func (m *BookmarkMutation) SetBookmarks(s string)
SetBookmarks sets the "bookmarks" field.
func (*BookmarkMutation) SetCreated ¶
func (m *BookmarkMutation) SetCreated(t time.Time)
SetCreated sets the "created" field.
func (*BookmarkMutation) SetDeleted ¶
func (m *BookmarkMutation) SetDeleted(t time.Time)
SetDeleted sets the "deleted" field.
func (*BookmarkMutation) SetField ¶
func (m *BookmarkMutation) 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 (*BookmarkMutation) SetID ¶
func (m *BookmarkMutation) SetID(id uuid.UUID)
SetID sets the value of the id field. Note that this operation is only accepted on creation of Bookmark entities.
func (*BookmarkMutation) SetLastUpdated ¶
func (m *BookmarkMutation) SetLastUpdated(t time.Time)
SetLastUpdated sets the "lastUpdated" field.
func (*BookmarkMutation) SetVersion ¶
func (m *BookmarkMutation) SetVersion(s string)
SetVersion sets the "version" field.
func (BookmarkMutation) Tx ¶
func (m BookmarkMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*BookmarkMutation) Type ¶
func (m *BookmarkMutation) Type() string
Type returns the node type of this mutation (Bookmark).
func (*BookmarkMutation) Version ¶
func (m *BookmarkMutation) Version() (r string, exists bool)
Version returns the value of the "version" field in the mutation.
func (*BookmarkMutation) Where ¶
func (m *BookmarkMutation) Where(ps ...predicate.Bookmark)
Where appends a list predicates to the BookmarkMutation builder.
type BookmarkQuery ¶
type BookmarkQuery struct {
// contains filtered or unexported fields
}
BookmarkQuery is the builder for querying Bookmark entities.
func (*BookmarkQuery) Aggregate ¶
func (bq *BookmarkQuery) Aggregate(fns ...AggregateFunc) *BookmarkSelect
Aggregate returns a BookmarkSelect configured with the given aggregations.
func (*BookmarkQuery) All ¶
func (bq *BookmarkQuery) All(ctx context.Context) ([]*Bookmark, error)
All executes the query and returns a list of Bookmarks.
func (*BookmarkQuery) AllX ¶
func (bq *BookmarkQuery) AllX(ctx context.Context) []*Bookmark
AllX is like All, but panics if an error occurs.
func (*BookmarkQuery) Clone ¶
func (bq *BookmarkQuery) Clone() *BookmarkQuery
Clone returns a duplicate of the BookmarkQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*BookmarkQuery) Count ¶
func (bq *BookmarkQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*BookmarkQuery) CountX ¶
func (bq *BookmarkQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*BookmarkQuery) Exist ¶
func (bq *BookmarkQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*BookmarkQuery) ExistX ¶
func (bq *BookmarkQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*BookmarkQuery) First ¶
func (bq *BookmarkQuery) First(ctx context.Context) (*Bookmark, error)
First returns the first Bookmark entity from the query. Returns a *NotFoundError when no Bookmark was found.
func (*BookmarkQuery) FirstID ¶
FirstID returns the first Bookmark ID from the query. Returns a *NotFoundError when no Bookmark ID was found.
func (*BookmarkQuery) FirstIDX ¶
func (bq *BookmarkQuery) FirstIDX(ctx context.Context) uuid.UUID
FirstIDX is like FirstID, but panics if an error occurs.
func (*BookmarkQuery) FirstX ¶
func (bq *BookmarkQuery) FirstX(ctx context.Context) *Bookmark
FirstX is like First, but panics if an error occurs.
func (*BookmarkQuery) GroupBy ¶
func (bq *BookmarkQuery) GroupBy(field string, fields ...string) *BookmarkGroupBy
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 { Bookmarks string `json:"bookmarks,omitempty"` Count int `json:"count,omitempty"` } client.Bookmark.Query(). GroupBy(bookmark.FieldBookmarks). Aggregate(ent.Count()). Scan(ctx, &v)
func (*BookmarkQuery) IDsX ¶
func (bq *BookmarkQuery) IDsX(ctx context.Context) []uuid.UUID
IDsX is like IDs, but panics if an error occurs.
func (*BookmarkQuery) Limit ¶
func (bq *BookmarkQuery) Limit(limit int) *BookmarkQuery
Limit adds a limit step to the query.
func (*BookmarkQuery) Offset ¶
func (bq *BookmarkQuery) Offset(offset int) *BookmarkQuery
Offset adds an offset step to the query.
func (*BookmarkQuery) Only ¶
func (bq *BookmarkQuery) Only(ctx context.Context) (*Bookmark, error)
Only returns a single Bookmark entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Bookmark entity is found. Returns a *NotFoundError when no Bookmark entities are found.
func (*BookmarkQuery) OnlyID ¶
OnlyID is like Only, but returns the only Bookmark ID in the query. Returns a *NotSingularError when more than one Bookmark ID is found. Returns a *NotFoundError when no entities are found.
func (*BookmarkQuery) OnlyIDX ¶
func (bq *BookmarkQuery) OnlyIDX(ctx context.Context) uuid.UUID
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*BookmarkQuery) OnlyX ¶
func (bq *BookmarkQuery) OnlyX(ctx context.Context) *Bookmark
OnlyX is like Only, but panics if an error occurs.
func (*BookmarkQuery) Order ¶
func (bq *BookmarkQuery) Order(o ...OrderFunc) *BookmarkQuery
Order adds an order step to the query.
func (*BookmarkQuery) Select ¶
func (bq *BookmarkQuery) Select(fields ...string) *BookmarkSelect
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 { Bookmarks string `json:"bookmarks,omitempty"` } client.Bookmark.Query(). Select(bookmark.FieldBookmarks). Scan(ctx, &v)
func (*BookmarkQuery) Unique ¶
func (bq *BookmarkQuery) Unique(unique bool) *BookmarkQuery
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 (*BookmarkQuery) Where ¶
func (bq *BookmarkQuery) Where(ps ...predicate.Bookmark) *BookmarkQuery
Where adds a new predicate for the BookmarkQuery builder.
type BookmarkSelect ¶
type BookmarkSelect struct { *BookmarkQuery // contains filtered or unexported fields }
BookmarkSelect is the builder for selecting fields of Bookmark entities.
func (*BookmarkSelect) Aggregate ¶
func (bs *BookmarkSelect) Aggregate(fns ...AggregateFunc) *BookmarkSelect
Aggregate adds the given aggregation functions to the selector query.
func (*BookmarkSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*BookmarkSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*BookmarkSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*BookmarkSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*BookmarkSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*BookmarkSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*BookmarkSelect) Scan ¶
func (bs *BookmarkSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*BookmarkSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type BookmarkUpdate ¶
type BookmarkUpdate struct {
// contains filtered or unexported fields
}
BookmarkUpdate is the builder for updating Bookmark entities.
func (*BookmarkUpdate) ClearDeleted ¶
func (bu *BookmarkUpdate) ClearDeleted() *BookmarkUpdate
ClearDeleted clears the value of the "deleted" field.
func (*BookmarkUpdate) Exec ¶
func (bu *BookmarkUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*BookmarkUpdate) ExecX ¶
func (bu *BookmarkUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*BookmarkUpdate) Mutation ¶
func (bu *BookmarkUpdate) Mutation() *BookmarkMutation
Mutation returns the BookmarkMutation object of the builder.
func (*BookmarkUpdate) Save ¶
func (bu *BookmarkUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*BookmarkUpdate) SaveX ¶
func (bu *BookmarkUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*BookmarkUpdate) SetBookmarks ¶
func (bu *BookmarkUpdate) SetBookmarks(s string) *BookmarkUpdate
SetBookmarks sets the "bookmarks" field.
func (*BookmarkUpdate) SetCreated ¶
func (bu *BookmarkUpdate) SetCreated(t time.Time) *BookmarkUpdate
SetCreated sets the "created" field.
func (*BookmarkUpdate) SetDeleted ¶
func (bu *BookmarkUpdate) SetDeleted(t time.Time) *BookmarkUpdate
SetDeleted sets the "deleted" field.
func (*BookmarkUpdate) SetLastUpdated ¶
func (bu *BookmarkUpdate) SetLastUpdated(t time.Time) *BookmarkUpdate
SetLastUpdated sets the "lastUpdated" field.
func (*BookmarkUpdate) SetNillableCreated ¶
func (bu *BookmarkUpdate) SetNillableCreated(t *time.Time) *BookmarkUpdate
SetNillableCreated sets the "created" field if the given value is not nil.
func (*BookmarkUpdate) SetNillableDeleted ¶
func (bu *BookmarkUpdate) SetNillableDeleted(t *time.Time) *BookmarkUpdate
SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (*BookmarkUpdate) SetNillableVersion ¶
func (bu *BookmarkUpdate) SetNillableVersion(s *string) *BookmarkUpdate
SetNillableVersion sets the "version" field if the given value is not nil.
func (*BookmarkUpdate) SetVersion ¶
func (bu *BookmarkUpdate) SetVersion(s string) *BookmarkUpdate
SetVersion sets the "version" field.
func (*BookmarkUpdate) Where ¶
func (bu *BookmarkUpdate) Where(ps ...predicate.Bookmark) *BookmarkUpdate
Where appends a list predicates to the BookmarkUpdate builder.
type BookmarkUpdateOne ¶
type BookmarkUpdateOne struct {
// contains filtered or unexported fields
}
BookmarkUpdateOne is the builder for updating a single Bookmark entity.
func (*BookmarkUpdateOne) ClearDeleted ¶
func (buo *BookmarkUpdateOne) ClearDeleted() *BookmarkUpdateOne
ClearDeleted clears the value of the "deleted" field.
func (*BookmarkUpdateOne) Exec ¶
func (buo *BookmarkUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*BookmarkUpdateOne) ExecX ¶
func (buo *BookmarkUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*BookmarkUpdateOne) Mutation ¶
func (buo *BookmarkUpdateOne) Mutation() *BookmarkMutation
Mutation returns the BookmarkMutation object of the builder.
func (*BookmarkUpdateOne) Save ¶
func (buo *BookmarkUpdateOne) Save(ctx context.Context) (*Bookmark, error)
Save executes the query and returns the updated Bookmark entity.
func (*BookmarkUpdateOne) SaveX ¶
func (buo *BookmarkUpdateOne) SaveX(ctx context.Context) *Bookmark
SaveX is like Save, but panics if an error occurs.
func (*BookmarkUpdateOne) Select ¶
func (buo *BookmarkUpdateOne) Select(field string, fields ...string) *BookmarkUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*BookmarkUpdateOne) SetBookmarks ¶
func (buo *BookmarkUpdateOne) SetBookmarks(s string) *BookmarkUpdateOne
SetBookmarks sets the "bookmarks" field.
func (*BookmarkUpdateOne) SetCreated ¶
func (buo *BookmarkUpdateOne) SetCreated(t time.Time) *BookmarkUpdateOne
SetCreated sets the "created" field.
func (*BookmarkUpdateOne) SetDeleted ¶
func (buo *BookmarkUpdateOne) SetDeleted(t time.Time) *BookmarkUpdateOne
SetDeleted sets the "deleted" field.
func (*BookmarkUpdateOne) SetLastUpdated ¶
func (buo *BookmarkUpdateOne) SetLastUpdated(t time.Time) *BookmarkUpdateOne
SetLastUpdated sets the "lastUpdated" field.
func (*BookmarkUpdateOne) SetNillableCreated ¶
func (buo *BookmarkUpdateOne) SetNillableCreated(t *time.Time) *BookmarkUpdateOne
SetNillableCreated sets the "created" field if the given value is not nil.
func (*BookmarkUpdateOne) SetNillableDeleted ¶
func (buo *BookmarkUpdateOne) SetNillableDeleted(t *time.Time) *BookmarkUpdateOne
SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (*BookmarkUpdateOne) SetNillableVersion ¶
func (buo *BookmarkUpdateOne) SetNillableVersion(s *string) *BookmarkUpdateOne
SetNillableVersion sets the "version" field if the given value is not nil.
func (*BookmarkUpdateOne) SetVersion ¶
func (buo *BookmarkUpdateOne) SetVersion(s string) *BookmarkUpdateOne
SetVersion sets the "version" field.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Bookmark is the client for interacting with the Bookmark builders. Bookmark *BookmarkClient // 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(). Bookmark. Query(). Count(ctx)
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 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 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 Tx ¶
type Tx struct { // Bookmark is the client for interacting with the Bookmark builders. Bookmark *BookmarkClient // 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 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.