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 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 Templates
- type TemplatesClient
- func (c *TemplatesClient) Create() *TemplatesCreate
- func (c *TemplatesClient) CreateBulk(builders ...*TemplatesCreate) *TemplatesCreateBulk
- func (c *TemplatesClient) Delete() *TemplatesDelete
- func (c *TemplatesClient) DeleteOne(t *Templates) *TemplatesDeleteOne
- func (c *TemplatesClient) DeleteOneID(id int) *TemplatesDeleteOne
- func (c *TemplatesClient) Get(ctx context.Context, id int) (*Templates, error)
- func (c *TemplatesClient) GetX(ctx context.Context, id int) *Templates
- func (c *TemplatesClient) Hooks() []Hook
- func (c *TemplatesClient) Query() *TemplatesQuery
- func (c *TemplatesClient) Update() *TemplatesUpdate
- func (c *TemplatesClient) UpdateOne(t *Templates) *TemplatesUpdateOne
- func (c *TemplatesClient) UpdateOneID(id int) *TemplatesUpdateOne
- func (c *TemplatesClient) Use(hooks ...Hook)
- type TemplatesCreate
- func (tc *TemplatesCreate) Exec(ctx context.Context) error
- func (tc *TemplatesCreate) ExecX(ctx context.Context)
- func (tc *TemplatesCreate) Mutation() *TemplatesMutation
- func (tc *TemplatesCreate) OnConflict(opts ...sql.ConflictOption) *TemplatesUpsertOne
- func (tc *TemplatesCreate) OnConflictColumns(columns ...string) *TemplatesUpsertOne
- func (tc *TemplatesCreate) Save(ctx context.Context) (*Templates, error)
- func (tc *TemplatesCreate) SaveX(ctx context.Context) *Templates
- func (tc *TemplatesCreate) SetName(s string) *TemplatesCreate
- func (tc *TemplatesCreate) SetTemplate(s string) *TemplatesCreate
- type TemplatesCreateBulk
- func (tcb *TemplatesCreateBulk) Exec(ctx context.Context) error
- func (tcb *TemplatesCreateBulk) ExecX(ctx context.Context)
- func (tcb *TemplatesCreateBulk) OnConflict(opts ...sql.ConflictOption) *TemplatesUpsertBulk
- func (tcb *TemplatesCreateBulk) OnConflictColumns(columns ...string) *TemplatesUpsertBulk
- func (tcb *TemplatesCreateBulk) Save(ctx context.Context) ([]*Templates, error)
- func (tcb *TemplatesCreateBulk) SaveX(ctx context.Context) []*Templates
- type TemplatesDelete
- type TemplatesDeleteOne
- type TemplatesGroupBy
- func (tgb *TemplatesGroupBy) Aggregate(fns ...AggregateFunc) *TemplatesGroupBy
- func (s *TemplatesGroupBy) Bool(ctx context.Context) (_ bool, err error)
- func (s *TemplatesGroupBy) BoolX(ctx context.Context) bool
- func (s *TemplatesGroupBy) Bools(ctx context.Context) ([]bool, error)
- func (s *TemplatesGroupBy) BoolsX(ctx context.Context) []bool
- func (s *TemplatesGroupBy) Float64(ctx context.Context) (_ float64, err error)
- func (s *TemplatesGroupBy) Float64X(ctx context.Context) float64
- func (s *TemplatesGroupBy) Float64s(ctx context.Context) ([]float64, error)
- func (s *TemplatesGroupBy) Float64sX(ctx context.Context) []float64
- func (s *TemplatesGroupBy) Int(ctx context.Context) (_ int, err error)
- func (s *TemplatesGroupBy) IntX(ctx context.Context) int
- func (s *TemplatesGroupBy) Ints(ctx context.Context) ([]int, error)
- func (s *TemplatesGroupBy) IntsX(ctx context.Context) []int
- func (tgb *TemplatesGroupBy) Scan(ctx context.Context, v any) error
- func (s *TemplatesGroupBy) ScanX(ctx context.Context, v any)
- func (s *TemplatesGroupBy) String(ctx context.Context) (_ string, err error)
- func (s *TemplatesGroupBy) StringX(ctx context.Context) string
- func (s *TemplatesGroupBy) Strings(ctx context.Context) ([]string, error)
- func (s *TemplatesGroupBy) StringsX(ctx context.Context) []string
- type TemplatesMutation
- func (m *TemplatesMutation) AddField(name string, value ent.Value) error
- func (m *TemplatesMutation) AddedEdges() []string
- func (m *TemplatesMutation) AddedField(name string) (ent.Value, bool)
- func (m *TemplatesMutation) AddedFields() []string
- func (m *TemplatesMutation) AddedIDs(name string) []ent.Value
- func (m *TemplatesMutation) ClearEdge(name string) error
- func (m *TemplatesMutation) ClearField(name string) error
- func (m *TemplatesMutation) ClearedEdges() []string
- func (m *TemplatesMutation) ClearedFields() []string
- func (m TemplatesMutation) Client() *Client
- func (m *TemplatesMutation) EdgeCleared(name string) bool
- func (m *TemplatesMutation) Field(name string) (ent.Value, bool)
- func (m *TemplatesMutation) FieldCleared(name string) bool
- func (m *TemplatesMutation) Fields() []string
- func (m *TemplatesMutation) ID() (id int, exists bool)
- func (m *TemplatesMutation) IDs(ctx context.Context) ([]int, error)
- func (m *TemplatesMutation) Name() (r string, exists bool)
- func (m *TemplatesMutation) OldField(ctx context.Context, name string) (ent.Value, error)
- func (m *TemplatesMutation) OldName(ctx context.Context) (v string, err error)
- func (m *TemplatesMutation) OldTemplate(ctx context.Context) (v string, err error)
- func (m *TemplatesMutation) Op() Op
- func (m *TemplatesMutation) RemovedEdges() []string
- func (m *TemplatesMutation) RemovedIDs(name string) []ent.Value
- func (m *TemplatesMutation) ResetEdge(name string) error
- func (m *TemplatesMutation) ResetField(name string) error
- func (m *TemplatesMutation) ResetName()
- func (m *TemplatesMutation) ResetTemplate()
- func (m *TemplatesMutation) SetField(name string, value ent.Value) error
- func (m *TemplatesMutation) SetName(s string)
- func (m *TemplatesMutation) SetTemplate(s string)
- func (m *TemplatesMutation) Template() (r string, exists bool)
- func (m TemplatesMutation) Tx() (*Tx, error)
- func (m *TemplatesMutation) Type() string
- func (m *TemplatesMutation) Where(ps ...predicate.Templates)
- type TemplatesQuery
- func (tq *TemplatesQuery) All(ctx context.Context) ([]*Templates, error)
- func (tq *TemplatesQuery) AllX(ctx context.Context) []*Templates
- func (tq *TemplatesQuery) Clone() *TemplatesQuery
- func (tq *TemplatesQuery) Count(ctx context.Context) (int, error)
- func (tq *TemplatesQuery) CountX(ctx context.Context) int
- func (tq *TemplatesQuery) Exist(ctx context.Context) (bool, error)
- func (tq *TemplatesQuery) ExistX(ctx context.Context) bool
- func (tq *TemplatesQuery) First(ctx context.Context) (*Templates, error)
- func (tq *TemplatesQuery) FirstID(ctx context.Context) (id int, err error)
- func (tq *TemplatesQuery) FirstIDX(ctx context.Context) int
- func (tq *TemplatesQuery) FirstX(ctx context.Context) *Templates
- func (tq *TemplatesQuery) GroupBy(field string, fields ...string) *TemplatesGroupBy
- func (tq *TemplatesQuery) IDs(ctx context.Context) ([]int, error)
- func (tq *TemplatesQuery) IDsX(ctx context.Context) []int
- func (tq *TemplatesQuery) Limit(limit int) *TemplatesQuery
- func (tq *TemplatesQuery) Offset(offset int) *TemplatesQuery
- func (tq *TemplatesQuery) Only(ctx context.Context) (*Templates, error)
- func (tq *TemplatesQuery) OnlyID(ctx context.Context) (id int, err error)
- func (tq *TemplatesQuery) OnlyIDX(ctx context.Context) int
- func (tq *TemplatesQuery) OnlyX(ctx context.Context) *Templates
- func (tq *TemplatesQuery) Order(o ...OrderFunc) *TemplatesQuery
- func (tq *TemplatesQuery) Select(fields ...string) *TemplatesSelect
- func (tq *TemplatesQuery) Unique(unique bool) *TemplatesQuery
- func (tq *TemplatesQuery) Where(ps ...predicate.Templates) *TemplatesQuery
- type TemplatesSelect
- func (s *TemplatesSelect) Bool(ctx context.Context) (_ bool, err error)
- func (s *TemplatesSelect) BoolX(ctx context.Context) bool
- func (s *TemplatesSelect) Bools(ctx context.Context) ([]bool, error)
- func (s *TemplatesSelect) BoolsX(ctx context.Context) []bool
- func (s *TemplatesSelect) Float64(ctx context.Context) (_ float64, err error)
- func (s *TemplatesSelect) Float64X(ctx context.Context) float64
- func (s *TemplatesSelect) Float64s(ctx context.Context) ([]float64, error)
- func (s *TemplatesSelect) Float64sX(ctx context.Context) []float64
- func (s *TemplatesSelect) Int(ctx context.Context) (_ int, err error)
- func (s *TemplatesSelect) IntX(ctx context.Context) int
- func (s *TemplatesSelect) Ints(ctx context.Context) ([]int, error)
- func (s *TemplatesSelect) IntsX(ctx context.Context) []int
- func (ts *TemplatesSelect) Scan(ctx context.Context, v any) error
- func (s *TemplatesSelect) ScanX(ctx context.Context, v any)
- func (s *TemplatesSelect) String(ctx context.Context) (_ string, err error)
- func (s *TemplatesSelect) StringX(ctx context.Context) string
- func (s *TemplatesSelect) Strings(ctx context.Context) ([]string, error)
- func (s *TemplatesSelect) StringsX(ctx context.Context) []string
- type TemplatesSlice
- type TemplatesUpdate
- func (tu *TemplatesUpdate) Exec(ctx context.Context) error
- func (tu *TemplatesUpdate) ExecX(ctx context.Context)
- func (tu *TemplatesUpdate) Mutation() *TemplatesMutation
- func (tu *TemplatesUpdate) Save(ctx context.Context) (int, error)
- func (tu *TemplatesUpdate) SaveX(ctx context.Context) int
- func (tu *TemplatesUpdate) SetName(s string) *TemplatesUpdate
- func (tu *TemplatesUpdate) SetTemplate(s string) *TemplatesUpdate
- func (tu *TemplatesUpdate) Where(ps ...predicate.Templates) *TemplatesUpdate
- type TemplatesUpdateOne
- func (tuo *TemplatesUpdateOne) Exec(ctx context.Context) error
- func (tuo *TemplatesUpdateOne) ExecX(ctx context.Context)
- func (tuo *TemplatesUpdateOne) Mutation() *TemplatesMutation
- func (tuo *TemplatesUpdateOne) Save(ctx context.Context) (*Templates, error)
- func (tuo *TemplatesUpdateOne) SaveX(ctx context.Context) *Templates
- func (tuo *TemplatesUpdateOne) Select(field string, fields ...string) *TemplatesUpdateOne
- func (tuo *TemplatesUpdateOne) SetName(s string) *TemplatesUpdateOne
- func (tuo *TemplatesUpdateOne) SetTemplate(s string) *TemplatesUpdateOne
- type TemplatesUpsert
- type TemplatesUpsertBulk
- func (u *TemplatesUpsertBulk) DoNothing() *TemplatesUpsertBulk
- func (u *TemplatesUpsertBulk) Exec(ctx context.Context) error
- func (u *TemplatesUpsertBulk) ExecX(ctx context.Context)
- func (u *TemplatesUpsertBulk) Ignore() *TemplatesUpsertBulk
- func (u *TemplatesUpsertBulk) SetName(v string) *TemplatesUpsertBulk
- func (u *TemplatesUpsertBulk) SetTemplate(v string) *TemplatesUpsertBulk
- func (u *TemplatesUpsertBulk) Update(set func(*TemplatesUpsert)) *TemplatesUpsertBulk
- func (u *TemplatesUpsertBulk) UpdateName() *TemplatesUpsertBulk
- func (u *TemplatesUpsertBulk) UpdateNewValues() *TemplatesUpsertBulk
- func (u *TemplatesUpsertBulk) UpdateTemplate() *TemplatesUpsertBulk
- type TemplatesUpsertOne
- func (u *TemplatesUpsertOne) DoNothing() *TemplatesUpsertOne
- func (u *TemplatesUpsertOne) Exec(ctx context.Context) error
- func (u *TemplatesUpsertOne) ExecX(ctx context.Context)
- func (u *TemplatesUpsertOne) ID(ctx context.Context) (id int, err error)
- func (u *TemplatesUpsertOne) IDX(ctx context.Context) int
- func (u *TemplatesUpsertOne) Ignore() *TemplatesUpsertOne
- func (u *TemplatesUpsertOne) SetName(v string) *TemplatesUpsertOne
- func (u *TemplatesUpsertOne) SetTemplate(v string) *TemplatesUpsertOne
- func (u *TemplatesUpsertOne) Update(set func(*TemplatesUpsert)) *TemplatesUpsertOne
- func (u *TemplatesUpsertOne) UpdateName() *TemplatesUpsertOne
- func (u *TemplatesUpsertOne) UpdateNewValues() *TemplatesUpsertOne
- func (u *TemplatesUpsertOne) UpdateTemplate() *TemplatesUpsertOne
- 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. TypeTemplates = "Templates" )
Variables ¶
This section is empty.
Functions ¶
func IsConstraintError ¶
IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotLoaded ¶
IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotSingular ¶
IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsValidationError ¶
IsValidationError returns a boolean indicating whether the error is a validation error.
func NewContext ¶
NewContext returns a new context with the given Client attached.
Types ¶
type AggregateFunc ¶
AggregateFunc applies an aggregation step on the group-by traversal/selector.
func As ¶
func As(fn AggregateFunc, end string) AggregateFunc
As is a pseudo aggregation function for renaming another other functions with custom names. For example:
GroupBy(field1, field2). Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")). Scan(ctx, &v)
func Count ¶
func Count() AggregateFunc
Count applies the "count" aggregation function on each group.
func Max ¶
func Max(field string) AggregateFunc
Max applies the "max" aggregation function on the given field of each group.
func Mean ¶
func Mean(field string) AggregateFunc
Mean applies the "mean" aggregation function on the given field of each group.
func Min ¶
func Min(field string) AggregateFunc
Min applies the "min" aggregation function on the given field of each group.
func Sum ¶
func Sum(field string) AggregateFunc
Sum applies the "sum" aggregation function on the given field of each group.
type Client ¶
type Client struct { // Schema is the client for creating, migrating and dropping schema. Schema *migrate.Schema // Templates is the client for interacting with the Templates builders. Templates *TemplatesClient // 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(). Templates. 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 Templates ¶
type Templates struct { // ID of the ent. ID int `json:"id,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Template holds the value of the "template" field. Template string `json:"template,omitempty"` // contains filtered or unexported fields }
Templates is the model entity for the Templates schema.
func (*Templates) Unwrap ¶
Unwrap unwraps the Templates 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 (*Templates) Update ¶
func (t *Templates) Update() *TemplatesUpdateOne
Update returns a builder for updating this Templates. Note that you need to call Templates.Unwrap() before calling this method if this Templates was returned from a transaction, and the transaction was committed or rolled back.
type TemplatesClient ¶
type TemplatesClient struct {
// contains filtered or unexported fields
}
TemplatesClient is a client for the Templates schema.
func NewTemplatesClient ¶
func NewTemplatesClient(c config) *TemplatesClient
NewTemplatesClient returns a client for the Templates from the given config.
func (*TemplatesClient) Create ¶
func (c *TemplatesClient) Create() *TemplatesCreate
Create returns a builder for creating a Templates entity.
func (*TemplatesClient) CreateBulk ¶
func (c *TemplatesClient) CreateBulk(builders ...*TemplatesCreate) *TemplatesCreateBulk
CreateBulk returns a builder for creating a bulk of Templates entities.
func (*TemplatesClient) Delete ¶
func (c *TemplatesClient) Delete() *TemplatesDelete
Delete returns a delete builder for Templates.
func (*TemplatesClient) DeleteOne ¶
func (c *TemplatesClient) DeleteOne(t *Templates) *TemplatesDeleteOne
DeleteOne returns a builder for deleting the given entity.
func (*TemplatesClient) DeleteOneID ¶
func (c *TemplatesClient) DeleteOneID(id int) *TemplatesDeleteOne
DeleteOne returns a builder for deleting the given entity by its id.
func (*TemplatesClient) GetX ¶
func (c *TemplatesClient) GetX(ctx context.Context, id int) *Templates
GetX is like Get, but panics if an error occurs.
func (*TemplatesClient) Hooks ¶
func (c *TemplatesClient) Hooks() []Hook
Hooks returns the client hooks.
func (*TemplatesClient) Query ¶
func (c *TemplatesClient) Query() *TemplatesQuery
Query returns a query builder for Templates.
func (*TemplatesClient) Update ¶
func (c *TemplatesClient) Update() *TemplatesUpdate
Update returns an update builder for Templates.
func (*TemplatesClient) UpdateOne ¶
func (c *TemplatesClient) UpdateOne(t *Templates) *TemplatesUpdateOne
UpdateOne returns an update builder for the given entity.
func (*TemplatesClient) UpdateOneID ¶
func (c *TemplatesClient) UpdateOneID(id int) *TemplatesUpdateOne
UpdateOneID returns an update builder for the given id.
func (*TemplatesClient) Use ¶
func (c *TemplatesClient) Use(hooks ...Hook)
Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `templates.Hooks(f(g(h())))`.
type TemplatesCreate ¶
type TemplatesCreate struct {
// contains filtered or unexported fields
}
TemplatesCreate is the builder for creating a Templates entity.
func (*TemplatesCreate) Exec ¶
func (tc *TemplatesCreate) Exec(ctx context.Context) error
Exec executes the query.
func (*TemplatesCreate) ExecX ¶
func (tc *TemplatesCreate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TemplatesCreate) Mutation ¶
func (tc *TemplatesCreate) Mutation() *TemplatesMutation
Mutation returns the TemplatesMutation object of the builder.
func (*TemplatesCreate) OnConflict ¶
func (tc *TemplatesCreate) OnConflict(opts ...sql.ConflictOption) *TemplatesUpsertOne
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Templates.Create(). SetName(v). OnConflict( // Update the row with the new values // the was proposed for insertion. sql.ResolveWithNewValues(), ). // Override some of the fields with custom // update values. Update(func(u *ent.TemplatesUpsert) { SetName(v+v). }). Exec(ctx)
func (*TemplatesCreate) OnConflictColumns ¶
func (tc *TemplatesCreate) OnConflictColumns(columns ...string) *TemplatesUpsertOne
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Templates.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
func (*TemplatesCreate) Save ¶
func (tc *TemplatesCreate) Save(ctx context.Context) (*Templates, error)
Save creates the Templates in the database.
func (*TemplatesCreate) SaveX ¶
func (tc *TemplatesCreate) SaveX(ctx context.Context) *Templates
SaveX calls Save and panics if Save returns an error.
func (*TemplatesCreate) SetName ¶
func (tc *TemplatesCreate) SetName(s string) *TemplatesCreate
SetName sets the "name" field.
func (*TemplatesCreate) SetTemplate ¶
func (tc *TemplatesCreate) SetTemplate(s string) *TemplatesCreate
SetTemplate sets the "template" field.
type TemplatesCreateBulk ¶
type TemplatesCreateBulk struct {
// contains filtered or unexported fields
}
TemplatesCreateBulk is the builder for creating many Templates entities in bulk.
func (*TemplatesCreateBulk) Exec ¶
func (tcb *TemplatesCreateBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*TemplatesCreateBulk) ExecX ¶
func (tcb *TemplatesCreateBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TemplatesCreateBulk) OnConflict ¶
func (tcb *TemplatesCreateBulk) OnConflict(opts ...sql.ConflictOption) *TemplatesUpsertBulk
OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:
client.Templates.CreateBulk(builders...). OnConflict( // Update the row with the new values // the was proposed for insertion. sql.ResolveWithNewValues(), ). // Override some of the fields with custom // update values. Update(func(u *ent.TemplatesUpsert) { SetName(v+v). }). Exec(ctx)
func (*TemplatesCreateBulk) OnConflictColumns ¶
func (tcb *TemplatesCreateBulk) OnConflictColumns(columns ...string) *TemplatesUpsertBulk
OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:
client.Templates.Create(). OnConflict(sql.ConflictColumns(columns...)). Exec(ctx)
type TemplatesDelete ¶
type TemplatesDelete struct {
// contains filtered or unexported fields
}
TemplatesDelete is the builder for deleting a Templates entity.
func (*TemplatesDelete) Exec ¶
func (td *TemplatesDelete) Exec(ctx context.Context) (int, error)
Exec executes the deletion query and returns how many vertices were deleted.
func (*TemplatesDelete) ExecX ¶
func (td *TemplatesDelete) ExecX(ctx context.Context) int
ExecX is like Exec, but panics if an error occurs.
func (*TemplatesDelete) Where ¶
func (td *TemplatesDelete) Where(ps ...predicate.Templates) *TemplatesDelete
Where appends a list predicates to the TemplatesDelete builder.
type TemplatesDeleteOne ¶
type TemplatesDeleteOne struct {
// contains filtered or unexported fields
}
TemplatesDeleteOne is the builder for deleting a single Templates entity.
func (*TemplatesDeleteOne) Exec ¶
func (tdo *TemplatesDeleteOne) Exec(ctx context.Context) error
Exec executes the deletion query.
func (*TemplatesDeleteOne) ExecX ¶
func (tdo *TemplatesDeleteOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
type TemplatesGroupBy ¶
type TemplatesGroupBy struct {
// contains filtered or unexported fields
}
TemplatesGroupBy is the group-by builder for Templates entities.
func (*TemplatesGroupBy) Aggregate ¶
func (tgb *TemplatesGroupBy) Aggregate(fns ...AggregateFunc) *TemplatesGroupBy
Aggregate adds the given aggregation functions to the group-by query.
func (*TemplatesGroupBy) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*TemplatesGroupBy) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*TemplatesGroupBy) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*TemplatesGroupBy) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*TemplatesGroupBy) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*TemplatesGroupBy) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*TemplatesGroupBy) Scan ¶
func (tgb *TemplatesGroupBy) Scan(ctx context.Context, v any) error
Scan applies the group-by query and scans the result into the given value.
func (*TemplatesGroupBy) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type TemplatesMutation ¶
type TemplatesMutation struct {
// contains filtered or unexported fields
}
TemplatesMutation represents an operation that mutates the Templates nodes in the graph.
func (*TemplatesMutation) AddField ¶
func (m *TemplatesMutation) 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 (*TemplatesMutation) AddedEdges ¶
func (m *TemplatesMutation) AddedEdges() []string
AddedEdges returns all edge names that were set/added in this mutation.
func (*TemplatesMutation) AddedField ¶
func (m *TemplatesMutation) 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 (*TemplatesMutation) AddedFields ¶
func (m *TemplatesMutation) AddedFields() []string
AddedFields returns all numeric fields that were incremented/decremented during this mutation.
func (*TemplatesMutation) AddedIDs ¶
func (m *TemplatesMutation) AddedIDs(name string) []ent.Value
AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.
func (*TemplatesMutation) ClearEdge ¶
func (m *TemplatesMutation) 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 (*TemplatesMutation) ClearField ¶
func (m *TemplatesMutation) 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 (*TemplatesMutation) ClearedEdges ¶
func (m *TemplatesMutation) ClearedEdges() []string
ClearedEdges returns all edge names that were cleared in this mutation.
func (*TemplatesMutation) ClearedFields ¶
func (m *TemplatesMutation) ClearedFields() []string
ClearedFields returns all nullable fields that were cleared during this mutation.
func (TemplatesMutation) Client ¶
func (m TemplatesMutation) 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 (*TemplatesMutation) EdgeCleared ¶
func (m *TemplatesMutation) EdgeCleared(name string) bool
EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.
func (*TemplatesMutation) Field ¶
func (m *TemplatesMutation) 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 (*TemplatesMutation) FieldCleared ¶
func (m *TemplatesMutation) FieldCleared(name string) bool
FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.
func (*TemplatesMutation) Fields ¶
func (m *TemplatesMutation) 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 (*TemplatesMutation) ID ¶
func (m *TemplatesMutation) ID() (id int, exists bool)
ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.
func (*TemplatesMutation) IDs ¶
func (m *TemplatesMutation) IDs(ctx context.Context) ([]int, error)
IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.
func (*TemplatesMutation) Name ¶
func (m *TemplatesMutation) Name() (r string, exists bool)
Name returns the value of the "name" field in the mutation.
func (*TemplatesMutation) 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 (*TemplatesMutation) OldName ¶
func (m *TemplatesMutation) OldName(ctx context.Context) (v string, err error)
OldName returns the old "name" field's value of the Templates entity. If the Templates 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 (*TemplatesMutation) OldTemplate ¶
func (m *TemplatesMutation) OldTemplate(ctx context.Context) (v string, err error)
OldTemplate returns the old "template" field's value of the Templates entity. If the Templates 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 (*TemplatesMutation) RemovedEdges ¶
func (m *TemplatesMutation) RemovedEdges() []string
RemovedEdges returns all edge names that were removed in this mutation.
func (*TemplatesMutation) RemovedIDs ¶
func (m *TemplatesMutation) 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 (*TemplatesMutation) ResetEdge ¶
func (m *TemplatesMutation) 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 (*TemplatesMutation) ResetField ¶
func (m *TemplatesMutation) 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 (*TemplatesMutation) ResetName ¶
func (m *TemplatesMutation) ResetName()
ResetName resets all changes to the "name" field.
func (*TemplatesMutation) ResetTemplate ¶
func (m *TemplatesMutation) ResetTemplate()
ResetTemplate resets all changes to the "template" field.
func (*TemplatesMutation) SetField ¶
func (m *TemplatesMutation) 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 (*TemplatesMutation) SetName ¶
func (m *TemplatesMutation) SetName(s string)
SetName sets the "name" field.
func (*TemplatesMutation) SetTemplate ¶
func (m *TemplatesMutation) SetTemplate(s string)
SetTemplate sets the "template" field.
func (*TemplatesMutation) Template ¶
func (m *TemplatesMutation) Template() (r string, exists bool)
Template returns the value of the "template" field in the mutation.
func (TemplatesMutation) Tx ¶
func (m TemplatesMutation) Tx() (*Tx, error)
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
func (*TemplatesMutation) Type ¶
func (m *TemplatesMutation) Type() string
Type returns the node type of this mutation (Templates).
func (*TemplatesMutation) Where ¶
func (m *TemplatesMutation) Where(ps ...predicate.Templates)
Where appends a list predicates to the TemplatesMutation builder.
type TemplatesQuery ¶
type TemplatesQuery struct {
// contains filtered or unexported fields
}
TemplatesQuery is the builder for querying Templates entities.
func (*TemplatesQuery) All ¶
func (tq *TemplatesQuery) All(ctx context.Context) ([]*Templates, error)
All executes the query and returns a list of TemplatesSlice.
func (*TemplatesQuery) AllX ¶
func (tq *TemplatesQuery) AllX(ctx context.Context) []*Templates
AllX is like All, but panics if an error occurs.
func (*TemplatesQuery) Clone ¶
func (tq *TemplatesQuery) Clone() *TemplatesQuery
Clone returns a duplicate of the TemplatesQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.
func (*TemplatesQuery) Count ¶
func (tq *TemplatesQuery) Count(ctx context.Context) (int, error)
Count returns the count of the given query.
func (*TemplatesQuery) CountX ¶
func (tq *TemplatesQuery) CountX(ctx context.Context) int
CountX is like Count, but panics if an error occurs.
func (*TemplatesQuery) Exist ¶
func (tq *TemplatesQuery) Exist(ctx context.Context) (bool, error)
Exist returns true if the query has elements in the graph.
func (*TemplatesQuery) ExistX ¶
func (tq *TemplatesQuery) ExistX(ctx context.Context) bool
ExistX is like Exist, but panics if an error occurs.
func (*TemplatesQuery) First ¶
func (tq *TemplatesQuery) First(ctx context.Context) (*Templates, error)
First returns the first Templates entity from the query. Returns a *NotFoundError when no Templates was found.
func (*TemplatesQuery) FirstID ¶
func (tq *TemplatesQuery) FirstID(ctx context.Context) (id int, err error)
FirstID returns the first Templates ID from the query. Returns a *NotFoundError when no Templates ID was found.
func (*TemplatesQuery) FirstIDX ¶
func (tq *TemplatesQuery) FirstIDX(ctx context.Context) int
FirstIDX is like FirstID, but panics if an error occurs.
func (*TemplatesQuery) FirstX ¶
func (tq *TemplatesQuery) FirstX(ctx context.Context) *Templates
FirstX is like First, but panics if an error occurs.
func (*TemplatesQuery) GroupBy ¶
func (tq *TemplatesQuery) GroupBy(field string, fields ...string) *TemplatesGroupBy
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 { Name string `json:"name,omitempty"` Count int `json:"count,omitempty"` } client.Templates.Query(). GroupBy(templates.FieldName). Aggregate(ent.Count()). Scan(ctx, &v)
func (*TemplatesQuery) IDs ¶
func (tq *TemplatesQuery) IDs(ctx context.Context) ([]int, error)
IDs executes the query and returns a list of Templates IDs.
func (*TemplatesQuery) IDsX ¶
func (tq *TemplatesQuery) IDsX(ctx context.Context) []int
IDsX is like IDs, but panics if an error occurs.
func (*TemplatesQuery) Limit ¶
func (tq *TemplatesQuery) Limit(limit int) *TemplatesQuery
Limit adds a limit step to the query.
func (*TemplatesQuery) Offset ¶
func (tq *TemplatesQuery) Offset(offset int) *TemplatesQuery
Offset adds an offset step to the query.
func (*TemplatesQuery) Only ¶
func (tq *TemplatesQuery) Only(ctx context.Context) (*Templates, error)
Only returns a single Templates entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Templates entity is found. Returns a *NotFoundError when no Templates entities are found.
func (*TemplatesQuery) OnlyID ¶
func (tq *TemplatesQuery) OnlyID(ctx context.Context) (id int, err error)
OnlyID is like Only, but returns the only Templates ID in the query. Returns a *NotSingularError when more than one Templates ID is found. Returns a *NotFoundError when no entities are found.
func (*TemplatesQuery) OnlyIDX ¶
func (tq *TemplatesQuery) OnlyIDX(ctx context.Context) int
OnlyIDX is like OnlyID, but panics if an error occurs.
func (*TemplatesQuery) OnlyX ¶
func (tq *TemplatesQuery) OnlyX(ctx context.Context) *Templates
OnlyX is like Only, but panics if an error occurs.
func (*TemplatesQuery) Order ¶
func (tq *TemplatesQuery) Order(o ...OrderFunc) *TemplatesQuery
Order adds an order step to the query.
func (*TemplatesQuery) Select ¶
func (tq *TemplatesQuery) Select(fields ...string) *TemplatesSelect
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 { Name string `json:"name,omitempty"` } client.Templates.Query(). Select(templates.FieldName). Scan(ctx, &v)
func (*TemplatesQuery) Unique ¶
func (tq *TemplatesQuery) Unique(unique bool) *TemplatesQuery
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 (*TemplatesQuery) Where ¶
func (tq *TemplatesQuery) Where(ps ...predicate.Templates) *TemplatesQuery
Where adds a new predicate for the TemplatesQuery builder.
type TemplatesSelect ¶
type TemplatesSelect struct { *TemplatesQuery // contains filtered or unexported fields }
TemplatesSelect is the builder for selecting fields of Templates entities.
func (*TemplatesSelect) Bool ¶
Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (*TemplatesSelect) Bools ¶
Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (*TemplatesSelect) Float64 ¶
Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (*TemplatesSelect) Float64s ¶
Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (*TemplatesSelect) Int ¶
Int returns a single int from a selector. It is only allowed when selecting one field.
func (*TemplatesSelect) Ints ¶
Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (*TemplatesSelect) Scan ¶
func (ts *TemplatesSelect) Scan(ctx context.Context, v any) error
Scan applies the selector query and scans the result into the given value.
func (*TemplatesSelect) String ¶
String returns a single string from a selector. It is only allowed when selecting one field.
type TemplatesSlice ¶
type TemplatesSlice []*Templates
TemplatesSlice is a parsable slice of Templates.
type TemplatesUpdate ¶
type TemplatesUpdate struct {
// contains filtered or unexported fields
}
TemplatesUpdate is the builder for updating Templates entities.
func (*TemplatesUpdate) Exec ¶
func (tu *TemplatesUpdate) Exec(ctx context.Context) error
Exec executes the query.
func (*TemplatesUpdate) ExecX ¶
func (tu *TemplatesUpdate) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TemplatesUpdate) Mutation ¶
func (tu *TemplatesUpdate) Mutation() *TemplatesMutation
Mutation returns the TemplatesMutation object of the builder.
func (*TemplatesUpdate) Save ¶
func (tu *TemplatesUpdate) Save(ctx context.Context) (int, error)
Save executes the query and returns the number of nodes affected by the update operation.
func (*TemplatesUpdate) SaveX ¶
func (tu *TemplatesUpdate) SaveX(ctx context.Context) int
SaveX is like Save, but panics if an error occurs.
func (*TemplatesUpdate) SetName ¶
func (tu *TemplatesUpdate) SetName(s string) *TemplatesUpdate
SetName sets the "name" field.
func (*TemplatesUpdate) SetTemplate ¶
func (tu *TemplatesUpdate) SetTemplate(s string) *TemplatesUpdate
SetTemplate sets the "template" field.
func (*TemplatesUpdate) Where ¶
func (tu *TemplatesUpdate) Where(ps ...predicate.Templates) *TemplatesUpdate
Where appends a list predicates to the TemplatesUpdate builder.
type TemplatesUpdateOne ¶
type TemplatesUpdateOne struct {
// contains filtered or unexported fields
}
TemplatesUpdateOne is the builder for updating a single Templates entity.
func (*TemplatesUpdateOne) Exec ¶
func (tuo *TemplatesUpdateOne) Exec(ctx context.Context) error
Exec executes the query on the entity.
func (*TemplatesUpdateOne) ExecX ¶
func (tuo *TemplatesUpdateOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TemplatesUpdateOne) Mutation ¶
func (tuo *TemplatesUpdateOne) Mutation() *TemplatesMutation
Mutation returns the TemplatesMutation object of the builder.
func (*TemplatesUpdateOne) Save ¶
func (tuo *TemplatesUpdateOne) Save(ctx context.Context) (*Templates, error)
Save executes the query and returns the updated Templates entity.
func (*TemplatesUpdateOne) SaveX ¶
func (tuo *TemplatesUpdateOne) SaveX(ctx context.Context) *Templates
SaveX is like Save, but panics if an error occurs.
func (*TemplatesUpdateOne) Select ¶
func (tuo *TemplatesUpdateOne) Select(field string, fields ...string) *TemplatesUpdateOne
Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.
func (*TemplatesUpdateOne) SetName ¶
func (tuo *TemplatesUpdateOne) SetName(s string) *TemplatesUpdateOne
SetName sets the "name" field.
func (*TemplatesUpdateOne) SetTemplate ¶
func (tuo *TemplatesUpdateOne) SetTemplate(s string) *TemplatesUpdateOne
SetTemplate sets the "template" field.
type TemplatesUpsert ¶
TemplatesUpsert is the "OnConflict" setter.
func (*TemplatesUpsert) SetName ¶
func (u *TemplatesUpsert) SetName(v string) *TemplatesUpsert
SetName sets the "name" field.
func (*TemplatesUpsert) SetTemplate ¶
func (u *TemplatesUpsert) SetTemplate(v string) *TemplatesUpsert
SetTemplate sets the "template" field.
func (*TemplatesUpsert) UpdateName ¶
func (u *TemplatesUpsert) UpdateName() *TemplatesUpsert
UpdateName sets the "name" field to the value that was provided on create.
func (*TemplatesUpsert) UpdateTemplate ¶
func (u *TemplatesUpsert) UpdateTemplate() *TemplatesUpsert
UpdateTemplate sets the "template" field to the value that was provided on create.
type TemplatesUpsertBulk ¶
type TemplatesUpsertBulk struct {
// contains filtered or unexported fields
}
TemplatesUpsertBulk is the builder for "upsert"-ing a bulk of Templates nodes.
func (*TemplatesUpsertBulk) DoNothing ¶
func (u *TemplatesUpsertBulk) DoNothing() *TemplatesUpsertBulk
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*TemplatesUpsertBulk) Exec ¶
func (u *TemplatesUpsertBulk) Exec(ctx context.Context) error
Exec executes the query.
func (*TemplatesUpsertBulk) ExecX ¶
func (u *TemplatesUpsertBulk) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TemplatesUpsertBulk) Ignore ¶
func (u *TemplatesUpsertBulk) Ignore() *TemplatesUpsertBulk
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Templates.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*TemplatesUpsertBulk) SetName ¶
func (u *TemplatesUpsertBulk) SetName(v string) *TemplatesUpsertBulk
SetName sets the "name" field.
func (*TemplatesUpsertBulk) SetTemplate ¶
func (u *TemplatesUpsertBulk) SetTemplate(v string) *TemplatesUpsertBulk
SetTemplate sets the "template" field.
func (*TemplatesUpsertBulk) Update ¶
func (u *TemplatesUpsertBulk) Update(set func(*TemplatesUpsert)) *TemplatesUpsertBulk
Update allows overriding fields `UPDATE` values. See the TemplatesCreateBulk.OnConflict documentation for more info.
func (*TemplatesUpsertBulk) UpdateName ¶
func (u *TemplatesUpsertBulk) UpdateName() *TemplatesUpsertBulk
UpdateName sets the "name" field to the value that was provided on create.
func (*TemplatesUpsertBulk) UpdateNewValues ¶
func (u *TemplatesUpsertBulk) UpdateNewValues() *TemplatesUpsertBulk
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.Templates.Create(). OnConflict( sql.ResolveWithNewValues(), ). Exec(ctx)
func (*TemplatesUpsertBulk) UpdateTemplate ¶
func (u *TemplatesUpsertBulk) UpdateTemplate() *TemplatesUpsertBulk
UpdateTemplate sets the "template" field to the value that was provided on create.
type TemplatesUpsertOne ¶
type TemplatesUpsertOne struct {
// contains filtered or unexported fields
}
TemplatesUpsertOne is the builder for "upsert"-ing
one Templates node.
func (*TemplatesUpsertOne) DoNothing ¶
func (u *TemplatesUpsertOne) DoNothing() *TemplatesUpsertOne
DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.
func (*TemplatesUpsertOne) Exec ¶
func (u *TemplatesUpsertOne) Exec(ctx context.Context) error
Exec executes the query.
func (*TemplatesUpsertOne) ExecX ¶
func (u *TemplatesUpsertOne) ExecX(ctx context.Context)
ExecX is like Exec, but panics if an error occurs.
func (*TemplatesUpsertOne) ID ¶
func (u *TemplatesUpsertOne) ID(ctx context.Context) (id int, err error)
Exec executes the UPSERT query and returns the inserted/updated ID.
func (*TemplatesUpsertOne) IDX ¶
func (u *TemplatesUpsertOne) IDX(ctx context.Context) int
IDX is like ID, but panics if an error occurs.
func (*TemplatesUpsertOne) Ignore ¶
func (u *TemplatesUpsertOne) Ignore() *TemplatesUpsertOne
Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:
client.Templates.Create(). OnConflict(sql.ResolveWithIgnore()). Exec(ctx)
func (*TemplatesUpsertOne) SetName ¶
func (u *TemplatesUpsertOne) SetName(v string) *TemplatesUpsertOne
SetName sets the "name" field.
func (*TemplatesUpsertOne) SetTemplate ¶
func (u *TemplatesUpsertOne) SetTemplate(v string) *TemplatesUpsertOne
SetTemplate sets the "template" field.
func (*TemplatesUpsertOne) Update ¶
func (u *TemplatesUpsertOne) Update(set func(*TemplatesUpsert)) *TemplatesUpsertOne
Update allows overriding fields `UPDATE` values. See the TemplatesCreate.OnConflict documentation for more info.
func (*TemplatesUpsertOne) UpdateName ¶
func (u *TemplatesUpsertOne) UpdateName() *TemplatesUpsertOne
UpdateName sets the "name" field to the value that was provided on create.
func (*TemplatesUpsertOne) UpdateNewValues ¶
func (u *TemplatesUpsertOne) UpdateNewValues() *TemplatesUpsertOne
UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:
client.Templates.Create(). OnConflict( sql.ResolveWithNewValues(), ). Exec(ctx)
func (*TemplatesUpsertOne) UpdateTemplate ¶
func (u *TemplatesUpsertOne) UpdateTemplate() *TemplatesUpsertOne
UpdateTemplate sets the "template" field to the value that was provided on create.
type Tx ¶
type Tx struct { // Templates is the client for interacting with the Templates builders. Templates *TemplatesClient // 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.