Documentation
¶
Index ¶
- func BindSimple[I any](binder *binding.Binder, simple *Simple[I], opts ...any)
- func Create(tableName string, callbacks *CreateCallbacks) binding.ServiceFunc[string]
- func CreateTx(tableName string, callbacks *CreateCallbacks) binding.ServiceFunc[string]
- func Delete(tableName string, callbacks *DeleteCallbacks) binding.ServiceFunc[any]
- func DeleteTx(tableName string, callbacks *DeleteCallbacks) binding.ServiceFunc[any]
- func GetByID[O any](tableName string, callbacks *GetByIDCallbacks[O]) binding.ServiceFunc[O]
- func Query[O any](tableName string, callbacks *QueryCallbacks[O], ...) binding.ServiceFunc[response.InfosData[O]]
- func Update(tableName string, callbacks *UpdateCallbacks) binding.ServiceFunc[any]
- func UpdateTx(tableName string, callbacks *UpdateCallbacks) binding.ServiceFunc[any]
- type ConditionFieldCallback
- type CreateCallbacks
- type CreateOption
- type CreateOptions
- type DeleteCallbacks
- type DeleteOption
- type DeleteOptions
- type GetByIDCallbacks
- type GetByIDOption
- type GetByIDOptions
- type GlobalOption
- type GlobalOptions
- type QueryCallbacks
- type QueryOption
- type QueryOptions
- type Simple
- type UpdateCallbacks
- type UpdateOption
- type UpdateOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(tableName string, callbacks *CreateCallbacks) binding.ServiceFunc[string]
func CreateTx ¶
func CreateTx(tableName string, callbacks *CreateCallbacks) binding.ServiceFunc[string]
func Delete ¶
func Delete(tableName string, callbacks *DeleteCallbacks) binding.ServiceFunc[any]
func DeleteTx ¶
func DeleteTx(tableName string, callbacks *DeleteCallbacks) binding.ServiceFunc[any]
func GetByID ¶
func GetByID[O any](tableName string, callbacks *GetByIDCallbacks[O]) binding.ServiceFunc[O]
func Query ¶
func Query[O any](tableName string, callbacks *QueryCallbacks[O], conditionFieldCallback ConditionFieldCallback) binding.ServiceFunc[response.InfosData[O]]
func Update ¶
func Update(tableName string, callbacks *UpdateCallbacks) binding.ServiceFunc[any]
func UpdateTx ¶
func UpdateTx(tableName string, callbacks *UpdateCallbacks) binding.ServiceFunc[any]
Types ¶
type ConditionFieldCallback ¶
type CreateCallbacks ¶ added in v0.2.3
type CreateCallbacks struct { Prepare func(e entity.Entity, i *infrastructure.Infrastructure) (map[string]any, error) Before func(e entity.Entity, prepared map[string]any, i *infrastructure.Infrastructure, tx database.Executor) error After func(e entity.Entity, prepared map[string]any, i *infrastructure.Infrastructure, tx database.Executor) error OnSuccessReturn func(e entity.Entity, prepared map[string]any, i *infrastructure.Infrastructure, id string) (string, error) OnErrorReturn func(e entity.Entity, prepared map[string]any, err error, i *infrastructure.Infrastructure) (string, error) }
type CreateOption ¶ added in v0.2.3
type CreateOption func(options *CreateOptions)
func WithCreateCallbacks ¶
func WithCreateCallbacks(callbacks *CreateCallbacks) CreateOption
func WithCreateMiddlewares ¶
func WithCreateMiddlewares(middlewares ...binding.Middleware) CreateOption
func WithCreateTx ¶
func WithCreateTx() CreateOption
func WithDisableCreate ¶
func WithDisableCreate() CreateOption
type CreateOptions ¶ added in v0.2.3
type CreateOptions struct {
// contains filtered or unexported fields
}
type DeleteCallbacks ¶ added in v0.2.3
type DeleteCallbacks struct { Prepare func(e entity.Entity, i *infrastructure.Infrastructure) (map[string]any, error) Before func(e entity.Entity, prepared map[string]any, i *infrastructure.Infrastructure, tx database.Executor) error After func(e entity.Entity, prepared map[string]any, i *infrastructure.Infrastructure, tx database.Executor) error OnSuccessReturn func(e entity.Entity, prepared map[string]any, i *infrastructure.Infrastructure) error OnErrorReturn func(e entity.Entity, prepared map[string]any, err error, i *infrastructure.Infrastructure) error }
type DeleteOption ¶ added in v0.2.3
type DeleteOption func(options *DeleteOptions)
func WithDeleteCallbacks ¶
func WithDeleteCallbacks(callbacks *DeleteCallbacks) DeleteOption
func WithDeleteMiddlewares ¶
func WithDeleteMiddlewares(middlewares ...binding.Middleware) DeleteOption
func WithDeleteTx ¶
func WithDeleteTx() DeleteOption
func WithDisableDelete ¶
func WithDisableDelete() DeleteOption
type DeleteOptions ¶ added in v0.2.3
type DeleteOptions struct {
// contains filtered or unexported fields
}
type GetByIDCallbacks ¶ added in v0.3.0
type GetByIDCallbacks[O any] struct { Before func(e entity.Entity, i *infrastructure.Infrastructure) error After func(e entity.Entity, i *infrastructure.Infrastructure) error OnSuccessReturn func(e entity.Entity, i *infrastructure.Infrastructure, output O) (O, error) OnErrorReturn func(e entity.Entity, err error, i *infrastructure.Infrastructure) (O, error) }
type GetByIDOption ¶ added in v0.3.0
type GetByIDOption[I any] func(options *GetByIDOptions[I])
func WithDisableGetByID ¶ added in v0.3.0
func WithDisableGetByID[I any]() GetByIDOption[I]
func WithGetByIDCallbacks ¶
func WithGetByIDCallbacks[I any](callbacks *GetByIDCallbacks[I]) GetByIDOption[I]
func WithGetByIDMiddlewares ¶
func WithGetByIDMiddlewares[I any](middlewares ...binding.Middleware) GetByIDOption[I]
type GetByIDOptions ¶ added in v0.3.0
type GetByIDOptions[I any] struct { // contains filtered or unexported fields }
type GlobalOption ¶ added in v0.8.0
type GlobalOption func(options *GlobalOptions)
func WithGlobalMiddlewares ¶ added in v0.8.0
func WithGlobalMiddlewares(middlewares ...binding.Middleware) GlobalOption
type GlobalOptions ¶ added in v0.8.0
type GlobalOptions struct {
// contains filtered or unexported fields
}
type QueryCallbacks ¶ added in v0.2.3
type QueryCallbacks[O any] struct { Before func(e entity.Entity, i *infrastructure.Infrastructure) error After func(e entity.Entity, i *infrastructure.Infrastructure) error OnSuccessReturn func(e entity.Entity, i *infrastructure.Infrastructure, output response.InfosData[O]) (response.InfosData[O], error) OnErrorReturn func(e entity.Entity, err error, i *infrastructure.Infrastructure) (response.InfosData[O], error) }
type QueryOption ¶ added in v0.2.3
type QueryOption[I any] func(options *QueryOptions[I])
func WithDisableQuery ¶
func WithDisableQuery[I any]() QueryOption[I]
func WithQueryCallbacks ¶
func WithQueryCallbacks[I any](callbacks *QueryCallbacks[I]) QueryOption[I]
func WithQueryConditionFieldCallback ¶
func WithQueryConditionFieldCallback[I any](callback ConditionFieldCallback) QueryOption[I]
func WithQueryMiddlewares ¶
func WithQueryMiddlewares[I any](middlewares ...binding.Middleware) QueryOption[I]
type QueryOptions ¶ added in v0.2.3
type QueryOptions[I any] struct { // contains filtered or unexported fields }
type Simple ¶
type Simple[I any] struct { // 使用的领域实体,注意是Entity类型 Entity entity.Entity // 数据库Schema Schema string // 创建使用的请求参数 CreateJsonBody request.Params // 删除使用的请求参数,注意是WithID类型 DeleteQueryParams request.IDRequestParam // 更新使用的请求参数,注意是WithID类型 UpdateJsonBody request.IDRequestParam // 查询使用的请求参数,注意是Query类型 QueryQueryParams request.QueryRequestParams // 根据ID查询使用的请求参数,注意是WithID类型 GetByIDQueryParams request.IDRequestParam // contains filtered or unexported fields }
Simple 实体CRUD的Bind参数 I 为查询相关接口返回的Info类型
type UpdateCallbacks ¶ added in v0.2.3
type UpdateCallbacks struct { Prepare func(e entity.Entity, i *infrastructure.Infrastructure) (map[string]any, error) Before func(e entity.Entity, prepared map[string]any, i *infrastructure.Infrastructure, tx database.Executor) error After func(e entity.Entity, prepared map[string]any, i *infrastructure.Infrastructure, tx database.Executor) error OnSuccessReturn func(e entity.Entity, prepared map[string]any, i *infrastructure.Infrastructure) error OnErrorReturn func(e entity.Entity, prepared map[string]any, err error, i *infrastructure.Infrastructure) error }
type UpdateOption ¶ added in v0.2.3
type UpdateOption func(options *UpdateOptions)
func WithDisableUpdate ¶
func WithDisableUpdate() UpdateOption
func WithUpdateCallbacks ¶
func WithUpdateCallbacks(callbacks *UpdateCallbacks) UpdateOption
func WithUpdateMiddlewares ¶
func WithUpdateMiddlewares(middlewares ...binding.Middleware) UpdateOption
func WithUpdateTx ¶
func WithUpdateTx() UpdateOption
type UpdateOptions ¶ added in v0.2.3
type UpdateOptions struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.