Documentation ¶
Index ¶
- func BindSimple[I any](binder *binding.Binder, simple *Simple[I], opts ...any)
- func Create(tableName string, callbacks *CreateCallbacks) binding.ServiceFunc[any]
- func CreateTx(tableName string, callbacks *CreateCallbacks) binding.ServiceFunc[any]
- func Delete(tableName string, callbacks *DeleteCallbacks) binding.ServiceFunc[any]
- func DeleteTx(tableName string, callbacks *DeleteCallbacks) binding.ServiceFunc[any]
- func Query[O any](tableName string, orderBy string, callbacks *QueryCallbacks[O], ...) binding.ServiceFunc[response.InfosData[O]]
- type ConditionFieldCallback
- type CreateCallbacks
- type CreateOption
- type CreateOptions
- type CustomCondition
- type DeleteCallbacks
- type DeleteOption
- type DeleteOptions
- type FormCustomConditionFunc
- type GlobalOption
- type GlobalOptions
- type QueryCallbacks
- type QueryOption
- func WithDisableQuery[I any]() QueryOption[I]
- func WithQueryCallbacks[I any](callbacks *QueryCallbacks[I]) QueryOption[I]
- func WithQueryConditionFieldCallback[I any](callback ConditionFieldCallback) QueryOption[I]
- func WithQueryFormCustomConditionFunc[I any](formCustomConditionFunc FormCustomConditionFunc) QueryOption[I]
- func WithQueryMiddlewares[I any](middlewares ...binding.Middleware) QueryOption[I]
- func WithQueryOrderBy[I any](orderBy string) QueryOption[I]
- type QueryOptions
- type Simple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(tableName string, callbacks *CreateCallbacks) binding.ServiceFunc[any]
func CreateTx ¶
func CreateTx(tableName string, callbacks *CreateCallbacks) binding.ServiceFunc[any]
func Delete ¶
func Delete(tableName string, callbacks *DeleteCallbacks) binding.ServiceFunc[any]
func DeleteTx ¶
func DeleteTx(tableName string, callbacks *DeleteCallbacks) binding.ServiceFunc[any]
func Query ¶
func Query[O any](tableName string, orderBy string, callbacks *QueryCallbacks[O], conditionFieldCallback ConditionFieldCallback, formCustomConditionFunc FormCustomConditionFunc) binding.ServiceFunc[response.InfosData[O]]
Types ¶
type ConditionFieldCallback ¶
type CreateCallbacks ¶ added in v0.2.3
type CreateCallbacks struct { Prepare func(c *api.Context, params request.Params, valueObject value_object.ValueObject, i *infrastructure.Infrastructure) (map[string]any, error) Before func(c *api.Context, params request.Params, valueObject value_object.ValueObject, prepared map[string]any, i *infrastructure.Infrastructure, tx database.Executor) error After func(c *api.Context, params request.Params, valueObject value_object.ValueObject, prepared map[string]any, i *infrastructure.Infrastructure, tx database.Executor) error OnSuccessReturn func(c *api.Context, params request.Params, valueObject value_object.ValueObject, prepared map[string]any, i *infrastructure.Infrastructure) error OnErrorReturn func(c *api.Context, params request.Params, valueObject value_object.ValueObject, prepared map[string]any, err error, i *infrastructure.Infrastructure) 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 CustomCondition ¶ added in v1.2.1
type CustomCondition struct { Conditions *sql.Conditions OrderBy string }
type DeleteCallbacks ¶ added in v0.2.3
type DeleteCallbacks struct { Prepare func(c *api.Context, params request.Params, valueObject value_object.ValueObject, i *infrastructure.Infrastructure) (map[string]any, error) Before func(c *api.Context, params request.Params, valueObject value_object.ValueObject, prepared map[string]any, i *infrastructure.Infrastructure, tx database.Executor) error After func(c *api.Context, params request.Params, valueObject value_object.ValueObject, prepared map[string]any, i *infrastructure.Infrastructure, tx database.Executor) error OnSuccessReturn func(c *api.Context, params request.Params, valueObject value_object.ValueObject, prepared map[string]any, i *infrastructure.Infrastructure) error OnErrorReturn func(c *api.Context, params request.Params, valueObject value_object.ValueObject, 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 FormCustomConditionFunc ¶ added in v1.2.1
type FormCustomConditionFunc func(c *api.Context, params request.Params, valueObject value_object.ValueObject) (*CustomCondition, error)
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(c *api.Context, params request.Params, valueObject value_object.ValueObject, i *infrastructure.Infrastructure) error After func(c *api.Context, params request.Params, valueObject value_object.ValueObject, i *infrastructure.Infrastructure) error OnSuccessReturn func(c *api.Context, params request.Params, valueObject value_object.ValueObject, i *infrastructure.Infrastructure, output response.InfosData[O]) (response.InfosData[O], error) OnErrorReturn func(c *api.Context, params request.Params, valueObject value_object.ValueObject, 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 WithQueryFormCustomConditionFunc ¶ added in v1.2.1
func WithQueryFormCustomConditionFunc[I any](formCustomConditionFunc FormCustomConditionFunc) QueryOption[I]
func WithQueryMiddlewares ¶
func WithQueryMiddlewares[I any](middlewares ...binding.Middleware) QueryOption[I]
func WithQueryOrderBy ¶ added in v0.11.8
func WithQueryOrderBy[I any](orderBy string) 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 { // 使用的领域实体,注意是ValueObject类型 ValueObject value_object.ValueObject // 数据库schema Schema string // 创建使用的请求参数 CreateJsonBody request.Params // 删除使用的请求参数 DeleteJsonBody request.Params // 查询使用的请求参数,注意是Query类型 QueryQueryParams request.QueryRequestParams // contains filtered or unexported fields }
Simple 值对象CRD的Bind参数 I 为查询相关接口返回的Info类型
Click to show internal directories.
Click to hide internal directories.