Documentation ¶
Index ¶
- Constants
- Variables
- func AddCreateHandler(config cfg.Config, logger log.Logger, d *httpserver.Definitions, version int, ...)
- func AddCrudHandlers(config cfg.Config, logger log.Logger, d *httpserver.Definitions, version int, ...)
- func AddDeleteHandler(config cfg.Config, logger log.Logger, d *httpserver.Definitions, version int, ...)
- func AddListHandler(config cfg.Config, logger log.Logger, d *httpserver.Definitions, version int, ...)
- func AddReadHandler(config cfg.Config, logger log.Logger, d *httpserver.Definitions, version int, ...)
- func AddUpdateHandler(config cfg.Config, logger log.Logger, d *httpserver.Definitions, version int, ...)
- func GetApiViewFromHeader(reqHeaders http.Header) string
- func NewCreateHandler(config cfg.Config, logger log.Logger, transformer CreateHandler) gin.HandlerFunc
- func NewDeleteHandler(config cfg.Config, logger log.Logger, transformer BaseHandler) gin.HandlerFunc
- func NewListHandler(_ cfg.Config, logger log.Logger, transformer ListHandler) gin.HandlerFunc
- func NewReadHandler(_ cfg.Config, logger log.Logger, transformer BaseHandler) gin.HandlerFunc
- func NewUpdateHandler(config cfg.Config, 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 Settings
- type UpdateHandler
Constants ¶
View Source
const ( SettingsConfigKey = "crud" DefaultApiView = "api" )
View Source
const HttpStatusClientClosedRequest = 499
Variables ¶
View Source
var ErrModelNotChanged = fmt.Errorf("nothing has changed on model")
Functions ¶
func AddCreateHandler ¶
func AddCreateHandler(config cfg.Config, logger log.Logger, d *httpserver.Definitions, version int, basePath string, handler CreateHandler)
func AddCrudHandlers ¶
func AddCrudHandlers(config cfg.Config, logger log.Logger, d *httpserver.Definitions, version int, basePath string, handler Handler)
func AddDeleteHandler ¶
func AddDeleteHandler(config cfg.Config, logger log.Logger, d *httpserver.Definitions, version int, basePath string, handler BaseHandler)
func AddListHandler ¶
func AddListHandler(config cfg.Config, logger log.Logger, d *httpserver.Definitions, version int, basePath string, handler ListHandler)
func AddReadHandler ¶
func AddReadHandler(config cfg.Config, logger log.Logger, d *httpserver.Definitions, version int, basePath string, handler BaseHandler)
func AddUpdateHandler ¶
func AddUpdateHandler(config cfg.Config, logger log.Logger, d *httpserver.Definitions, version int, basePath string, handler UpdateHandler)
func GetApiViewFromHeader ¶
func NewCreateHandler ¶
func NewCreateHandler(config cfg.Config, logger log.Logger, transformer CreateHandler) gin.HandlerFunc
func NewDeleteHandler ¶
func NewDeleteHandler(config cfg.Config, logger log.Logger, transformer BaseHandler) gin.HandlerFunc
func NewListHandler ¶
func NewListHandler(_ cfg.Config, logger log.Logger, transformer ListHandler) gin.HandlerFunc
func NewReadHandler ¶
func NewReadHandler(_ cfg.Config, logger log.Logger, transformer BaseHandler) gin.HandlerFunc
func NewUpdateHandler ¶
func NewUpdateHandler(config cfg.Config, logger log.Logger, transformer UpdateHandler) gin.HandlerFunc
Types ¶
type BaseCreateHandler ¶
type BaseHandler ¶
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 any) error Count(ctx context.Context, qb *db_repo.QueryBuilder, model db_repo.ModelBased) (int, error) GetMetadata() db_repo.Metadata }
type Settings ¶ added in v0.29.1
type Settings struct { // Applies to create, update and delete handlers. // Write timeout is the maximum duration before canceling any write operation. WriteTimeout time.Duration `cfg:"write_timeout" default:"10m" validate:"min=1000000000"` }
Settings structure for all CRUDL handler.
type UpdateHandler ¶
type UpdateHandler interface { BaseHandler BaseUpdateHandler }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.