Documentation ¶
Index ¶
- func BindSimple[I any](binder *binding.Binder, simple *Simple[I], opts ...Option[I])
- func Create(tableName string, callbacks *Callbacks[string]) binding.ServiceFunc[string]
- func CreateTx(tableName string, callbacks *Callbacks[string]) binding.ServiceFunc[string]
- func Delete(tableName string, callbacks *Callbacks[any]) binding.ServiceFunc[any]
- func DeleteTx(tableName string, callbacks *Callbacks[any]) binding.ServiceFunc[any]
- func GetByID[O any](tableName string, callbacks *Callbacks[O]) binding.ServiceFunc[O]
- func Query[O any](tableName string, callbacks *Callbacks[response.InfosData[O]], ...) binding.ServiceFunc[response.InfosData[O]]
- func Update(tableName string, callbacks *Callbacks[any]) binding.ServiceFunc[any]
- func UpdateTx(tableName string, callbacks *Callbacks[any]) binding.ServiceFunc[any]
- type Callbacks
- type ConditionFieldCallback
- type Option
- func WithCreateCallbacks[I any](callbacks *Callbacks[string]) Option[I]
- func WithCreateMiddlewares[I any](middlewares []api.Handler) Option[I]
- func WithCreateTx[I any]() Option[I]
- func WithDeleteCallbacks[I any](callbacks *Callbacks[any]) Option[I]
- func WithDeleteMiddlewares[I any](middlewares []api.Handler) Option[I]
- func WithDeleteTx[I any]() Option[I]
- func WithDisableCreate[I any]() Option[I]
- func WithDisableDelete[I any]() Option[I]
- func WithDisableQuery[I any]() Option[I]
- func WithDisableQueryByID[I any]() Option[I]
- func WithDisableUpdate[I any]() Option[I]
- func WithGetByIDCallbacks[I any](callbacks *Callbacks[I]) Option[I]
- func WithGetByIDMiddlewares[I any](middlewares []api.Handler) Option[I]
- func WithQueryCallbacks[I any](callbacks *Callbacks[response.InfosData[I]]) Option[I]
- func WithQueryConditionFieldCallback[I any](callback ConditionFieldCallback) Option[I]
- func WithQueryMiddlewares[I any](middlewares []api.Handler) Option[I]
- func WithUpdateCallbacks[I any](callbacks *Callbacks[any]) Option[I]
- func WithUpdateMiddlewares[I any](middlewares []api.Handler) Option[I]
- func WithUpdateTx[I any]() Option[I]
- type Options
- type Simple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindSimple ¶
func GetByID ¶
func GetByID[O any](tableName string, callbacks *Callbacks[O]) binding.ServiceFunc[O]
Types ¶
type Callbacks ¶
type Callbacks[O any] struct { BeforeDBOperate func(e entity.Entity, i *infrastructure.Infrastructure, dbExecutor database.Executor) error AfterDBOperate func(e entity.Entity, i *infrastructure.Infrastructure, dbExecutor database.Executor) error OnSuccessReturn func(e entity.Entity, i *infrastructure.Infrastructure, output O) (O, error) OnErrorReturn func(e entity.Entity, err error, i *infrastructure.Infrastructure, defaultErrOutput O) (O, error) }
type ConditionFieldCallback ¶
type Option ¶
func WithCreateTx ¶
func WithDeleteTx ¶
func WithDisableCreate ¶
func WithDisableDelete ¶
func WithDisableQuery ¶
func WithDisableQueryByID ¶
func WithDisableUpdate ¶
func WithGetByIDCallbacks ¶
func WithGetByIDMiddlewares ¶
func WithQueryCallbacks ¶
func WithQueryConditionFieldCallback ¶
func WithQueryConditionFieldCallback[I any](callback ConditionFieldCallback) Option[I]
func WithUpdateTx ¶
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类型
Click to show internal directories.
Click to hide internal directories.