Documentation
¶
Index ¶
- Constants
- func AddDeletedAtField(schema *ogen.Schema)
- func AddRestoreEndpoint(name string, spec *ogen.Spec, basePath string, idParam *ogen.Parameter) error
- func AttachTo(name string, spec *ogen.Spec, base string, item *ogen.Schema, ...) error
- func IncludeTrashed(parent context.Context) context.Context
- func Interceptor[Q interface{ ... }](f func(ent.Query) (Q, error)) ent.Interceptor
- func Mutator[M interface{ ... }]() ent.Hook
- func NewSoftDeleteQueryContext(withTrashed *bool, ctx context.Context) context.Context
- func TrashedParam() *ogen.Parameter
- type Mixin
Constants ¶
const FieldDeletedAt = "deleted_at"
FieldDeletedAt holds the column name for the "deleted_at" field.
const ParamTrashed = "trashed"
ParamTrashed is the name of the query parameter to include trashed items
Variables ¶
This section is empty.
Functions ¶
func AddDeletedAtField ¶
AddDeletedAtField adds the "deleted_at" field to the oas schema
func AddRestoreEndpoint ¶
func AddRestoreEndpoint( name string, spec *ogen.Spec, basePath string, idParam *ogen.Parameter, ) error
AddRestoreEndpoint adds the restore endpoint to the OpenAPI spec
func AttachTo ¶
func AttachTo( name string, spec *ogen.Spec, base string, item *ogen.Schema, idParam *ogen.Parameter, ) error
AttachTo adds fields, parameters, and endpoints necessary to the soft delete pattern to the given OpenAPI spec, with the given ID parameter name.
func IncludeTrashed ¶
IncludeTrashed returns a new context that skips the soft-delete interceptor/mutators.
func Interceptor ¶
func Interceptor[Q interface{ WhereP(...func(*sql.Selector)) }]( f func(ent.Query) (Q, error), ) ent.Interceptor
Interceptor returns a new ent.Interceptor that implements the soft delete pattern.
func NewSoftDeleteQueryContext ¶
NewSoftDeleteQueryContext returns a new context that includes the soft delete pattern. If `ctx` is nil, it will create a new context.Background(). calls `IncludeTrashed` if `withTrashed` is `true`.
func TrashedParam ¶
TrashedParam returns the `trashed` query parameter