Documentation ¶
Index ¶
- Constants
- Variables
- func AddCreateHandler(logger log.Logger, d *apiserver.Definitions, version int, basePath string, ...)
- func AddCrudHandlers(logger log.Logger, d *apiserver.Definitions, version int, basePath string, ...)
- func AddDeleteHandler(logger log.Logger, d *apiserver.Definitions, version int, basePath string, ...)
- func AddListHandler(logger log.Logger, d *apiserver.Definitions, version int, basePath string, ...)
- func AddReadHandler(logger log.Logger, d *apiserver.Definitions, version int, basePath string, ...)
- func AddUpdateHandler(logger log.Logger, d *apiserver.Definitions, version int, basePath string, ...)
- func GetApiViewFromHeader(reqHeaders http.Header) string
- func NewCreateHandler(logger log.Logger, transformer CreateHandler) gin.HandlerFunc
- func NewDeleteHandler(logger log.Logger, transformer BaseHandler) gin.HandlerFunc
- func NewListHandler(logger log.Logger, transformer ListHandler) gin.HandlerFunc
- func NewReadHandler(logger log.Logger, transformer BaseHandler) gin.HandlerFunc
- func NewUpdateHandler(logger log.Logger, transformer UpdateHandler) gin.HandlerFunc
- type BaseCreateHandler
- type BaseHandler
- type BaseListHandler
- type BaseUpdateHandler
- type CreateHandler
- type Handler
- type ListHandler
- type Output
- type Repository
- type UpdateHandler
Constants ¶
View Source
const DefaultApiView = "api"
Variables ¶
View Source
var ErrModelNotChanged = fmt.Errorf("nothing has changed on model")
Functions ¶
func AddCreateHandler ¶
func AddCreateHandler(logger log.Logger, d *apiserver.Definitions, version int, basePath string, handler CreateHandler)
func AddCrudHandlers ¶
func AddDeleteHandler ¶
func AddDeleteHandler(logger log.Logger, d *apiserver.Definitions, version int, basePath string, handler BaseHandler)
func AddListHandler ¶
func AddListHandler(logger log.Logger, d *apiserver.Definitions, version int, basePath string, handler ListHandler)
func AddReadHandler ¶
func AddReadHandler(logger log.Logger, d *apiserver.Definitions, version int, basePath string, handler BaseHandler)
func AddUpdateHandler ¶
func AddUpdateHandler(logger log.Logger, d *apiserver.Definitions, version int, basePath string, handler UpdateHandler)
func GetApiViewFromHeader ¶
func NewCreateHandler ¶
func NewCreateHandler(logger log.Logger, transformer CreateHandler) gin.HandlerFunc
func NewDeleteHandler ¶
func NewDeleteHandler(logger log.Logger, transformer BaseHandler) gin.HandlerFunc
func NewListHandler ¶
func NewListHandler(logger log.Logger, transformer ListHandler) gin.HandlerFunc
func NewReadHandler ¶
func NewReadHandler(logger log.Logger, transformer BaseHandler) gin.HandlerFunc
func NewUpdateHandler ¶
func NewUpdateHandler(logger log.Logger, transformer UpdateHandler) gin.HandlerFunc
Types ¶
type BaseCreateHandler ¶
type BaseHandler ¶
type BaseHandler interface { GetRepository() Repository GetModel() db_repo.ModelBased TransformOutput(ctx context.Context, model db_repo.ModelBased, apiView string) (output interface{}, err error) }
type BaseListHandler ¶
type BaseUpdateHandler ¶
type CreateHandler ¶
type CreateHandler interface { BaseHandler BaseCreateHandler }
type Handler ¶
type Handler interface { BaseHandler BaseCreateHandler BaseUpdateHandler BaseListHandler }
type ListHandler ¶
type ListHandler interface { BaseHandler BaseListHandler }
type Repository ¶
type Repository interface { Create(ctx context.Context, value db_repo.ModelBased) error Read(ctx context.Context, id *uint, out db_repo.ModelBased) error Update(ctx context.Context, value db_repo.ModelBased) error Delete(ctx context.Context, value db_repo.ModelBased) error Query(ctx context.Context, qb *db_repo.QueryBuilder, result interface{}) error Count(ctx context.Context, qb *db_repo.QueryBuilder, model db_repo.ModelBased) (int, error) GetMetadata() db_repo.Metadata }
type UpdateHandler ¶
type UpdateHandler interface { BaseHandler BaseUpdateHandler }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.