ent

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Operation types.
	OpCreate    = ent.OpCreate
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne

	// Node types.
	TypeBookmark = "Bookmark"
)

Variables

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

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

Functions

func Asc

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

Asc applies the given fields in ASC order.

func Desc

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

Desc applies the given fields in DESC order.

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type 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) String

func (b *Bookmark) String() string

String implements the fmt.Stringer.

func (*Bookmark) Unwrap

func (b *Bookmark) Unwrap() *Bookmark

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.

func (*Bookmark) Value added in v0.1.3

func (b *Bookmark) Value(name string) (ent.Value, error)

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

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) Get

func (c *BookmarkClient) Get(ctx context.Context, id uuid.UUID) (*Bookmark, error)

Get returns a Bookmark entity by its id.

func (*BookmarkClient) GetX

func (c *BookmarkClient) GetX(ctx context.Context, id uuid.UUID) *Bookmark

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

func (*BookmarkClient) Hooks

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

Hooks returns the client hooks.

func (*BookmarkClient) Intercept added in v0.1.3

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

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

func (*BookmarkClient) Interceptors added in v0.1.3

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

Interceptors returns the client interceptors.

func (*BookmarkClient) MapCreateBulk added in v0.1.3

func (c *BookmarkClient) MapCreateBulk(slice any, setFunc func(*BookmarkCreate, int)) *BookmarkCreateBulk

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

func (*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.

func (*BookmarkCreateBulk) Save

func (bcb *BookmarkCreateBulk) Save(ctx context.Context) ([]*Bookmark, error)

Save creates the Bookmark entities in the database.

func (*BookmarkCreateBulk) SaveX

func (bcb *BookmarkCreateBulk) SaveX(ctx context.Context) []*Bookmark

SaveX is like Save, 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.

func (*BookmarkDeleteOne) Where added in v0.1.3

Where appends a list predicates to the BookmarkDelete builder.

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

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

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

func (*BookmarkGroupBy) BoolX

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

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

func (*BookmarkGroupBy) Bools

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

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

func (*BookmarkGroupBy) BoolsX

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

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

func (*BookmarkGroupBy) Float64

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

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

func (*BookmarkGroupBy) Float64X

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

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

func (*BookmarkGroupBy) Float64s

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

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

func (*BookmarkGroupBy) Float64sX

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

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

func (*BookmarkGroupBy) Int

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

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

func (*BookmarkGroupBy) IntX

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

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

func (*BookmarkGroupBy) Ints

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

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

func (*BookmarkGroupBy) IntsX

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

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

func (*BookmarkGroupBy) Scan

func (bgb *BookmarkGroupBy) Scan(ctx context.Context, v any) error

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

func (*BookmarkGroupBy) ScanX

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

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

func (*BookmarkGroupBy) String

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

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

func (*BookmarkGroupBy) StringX

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

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

func (*BookmarkGroupBy) Strings

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

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

func (*BookmarkGroupBy) StringsX

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

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

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

func (m *BookmarkMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*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

func (m *BookmarkMutation) OldCreated(ctx context.Context) (v time.Time, err error)

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

func (m *BookmarkMutation) OldDeleted(ctx context.Context) (v *time.Time, err error)

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

func (m *BookmarkMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*BookmarkMutation) OldLastUpdated

func (m *BookmarkMutation) OldLastUpdated(ctx context.Context) (v time.Time, err error)

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) Op

func (m *BookmarkMutation) Op() Op

Op returns the operation name.

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) SetOp added in v0.1.3

func (m *BookmarkMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

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.

func (*BookmarkMutation) WhereP added in v0.1.3

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

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

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

func (bq *BookmarkQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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) IDs

func (bq *BookmarkQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

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 the number of records to be returned by this query.

func (*BookmarkQuery) Offset

func (bq *BookmarkQuery) Offset(offset int) *BookmarkQuery

Offset to start from.

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

func (bq *BookmarkQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

Order specifies how the records should be ordered.

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

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

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

func (*BookmarkSelect) BoolX

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

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

func (*BookmarkSelect) Bools

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

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

func (*BookmarkSelect) BoolsX

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

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

func (*BookmarkSelect) Float64

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

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

func (*BookmarkSelect) Float64X

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

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

func (*BookmarkSelect) Float64s

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

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

func (*BookmarkSelect) Float64sX

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

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

func (*BookmarkSelect) Int

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

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

func (*BookmarkSelect) IntX

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

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

func (*BookmarkSelect) Ints

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

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

func (*BookmarkSelect) IntsX

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

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

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) ScanX

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

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

func (*BookmarkSelect) String

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

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

func (*BookmarkSelect) StringX

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

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

func (*BookmarkSelect) Strings

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

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

func (*BookmarkSelect) StringsX

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

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

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) SetNillableBookmarks added in v0.1.3

func (bu *BookmarkUpdate) SetNillableBookmarks(s *string) *BookmarkUpdate

SetNillableBookmarks sets the "bookmarks" field if the given value is not nil.

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) SetNillableBookmarks added in v0.1.3

func (buo *BookmarkUpdateOne) SetNillableBookmarks(s *string) *BookmarkUpdateOne

SetNillableBookmarks sets the "bookmarks" field if the given value is not nil.

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.

func (*BookmarkUpdateOne) Where added in v0.1.3

Where appends a list predicates to the BookmarkUpdate builder.

type Bookmarks

type Bookmarks []*Bookmark

Bookmarks is a parsable slice of Bookmark.

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

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.

func (*Client) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	Bookmark.
	Query().
	Count(ctx)

func (*Client) Intercept added in v0.1.3

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

Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.

func (*Client) Mutate added in v0.1.3

func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

Tx returns a new transactional client. The provided context is used until the transaction is committed or rolled back.

func (*Client) Use

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

Use adds the mutation hooks to all the entity clients. In order to add hooks to a specific client, call: `client.Node.Use(...)`.

type CommitFunc

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

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

func (CommitFunc) Commit

func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:

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

type Committer

type Committer interface {
	Commit(context.Context, *Tx) error
}

Committer is the interface that wraps the Commit method.

type ConstraintError

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

ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc added in v0.1.3

type InterceptFunc = ent.InterceptFunc

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

type Interceptor added in v0.1.3

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 Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

NotFoundError returns when trying to fetch a specific entity and it was not found in the database.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

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

type Policy

type Policy = ent.Policy

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

type Querier added in v0.1.3

type Querier = ent.Querier

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

type QuerierFunc added in v0.1.3

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext added in v0.1.3

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc added in v0.1.3

type TraverseFunc = ent.TraverseFunc

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

type Traverser added in v0.1.3

type Traverser = ent.Traverser

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

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

func TxFromContext(ctx context.Context) *Tx

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

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL