Documentation ¶
Index ¶
- func AsComponent[T any](f any, paramTags string, resultTags string) any
- func CtxWithUserUID(ctx context.Context, uid interface{}) context.Context
- func EncodeJSONResponse[T any](ctx context.Context, w http.ResponseWriter, response T) error
- func NewRouter(controllers []Controller) *mux.Router
- func UserUIDFromCtx(ctx context.Context) string
- type APIGatewayHandler
- type CRUD
- type CRUDLogger
- func (l *CRUDLogger[T]) Create(ctx context.Context, t T, opts query.Opts) (T, error)
- func (l *CRUDLogger[T]) Delete(ctx context.Context, id string) error
- func (l *CRUDLogger[T]) FindAll(ctx context.Context) ([]T, error)
- func (l *CRUDLogger[T]) FindByID(ctx context.Context, id string) (T, error)
- func (l *CRUDLogger[T]) Update(ctx context.Context, id string, t T) (T, error)
- type Control
- type Controller
- type Factory
- type Handle
- func NewCreateHandler[T any](name string, path string, factory Factory[T]) *Handle[T]
- func NewFindAllHandler[T any](name string, path string, repo Repository[T]) *Handle[T]
- func NewFindByIDHandler[T any](name string, path string, repo Repository[T]) *Handle[T]
- func NewGetHandler[T any](name string, path string, fun http.HandlerFunc) *Handle[T]
- func NewHandler[T any](name string, path string, requestType string, fun http.HandlerFunc) *Handle[T]
- func NewPostHandler[T any](name string, path string, fun http.HandlerFunc) *Handle[T]
- type Handler
- type LambdaHandler
- type RESTApi
- type Removal
- type Repository
- type Route
- type Router
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CtxWithUserUID ¶
CtxWithUserUID will return a context with UID stored as value.
func EncodeJSONResponse ¶
EncodeJSONResponse will take a given interface and encode the value as JSON
func NewRouter ¶
func NewRouter(controllers []Controller) *mux.Router
func UserUIDFromCtx ¶
UserUIDFromCtx will return user uid stored in context.
Types ¶
type APIGatewayHandler ¶
type APIGatewayHandler struct {
// contains filtered or unexported fields
}
func (*APIGatewayHandler) Handle ¶
func (s *APIGatewayHandler) Handle(ctx context.Context, request core.SwitchableAPIGatewayRequest) (*core.SwitchableAPIGatewayResponse, error)
type CRUDLogger ¶
type CRUDLogger[T any] struct{}
func NewCrudLogger ¶
func NewCrudLogger[T any]() *CRUDLogger[T]
type Control ¶
type Controller ¶
func NewCRUDController ¶
func NewCRUDController[T any](name string, path string, svc CRUD[T]) Controller
func NewController ¶
func NewController(root string, handlers []Handler) Controller
type Handle ¶
type Handle[T any] struct { Path string RequestType string Handle http.HandlerFunc // contains filtered or unexported fields }
func NewCreateHandler ¶
func NewFindAllHandler ¶
func NewFindAllHandler[T any](name string, path string, repo Repository[T]) *Handle[T]
func NewFindByIDHandler ¶
func NewFindByIDHandler[T any](name string, path string, repo Repository[T]) *Handle[T]
func NewGetHandler ¶
func NewHandler ¶
func NewPostHandler ¶
type LambdaHandler ¶
type LambdaHandler interface {
Handle(context.Context, core.SwitchableAPIGatewayRequest) (*core.SwitchableAPIGatewayResponse, error)
}
func NewAPIGatewayHandler ¶
func NewAPIGatewayHandler(router *mux.Router) LambdaHandler
type Repository ¶
type Router ¶
type Router struct { Controllers []Controller // contains filtered or unexported fields }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) RegisterAll ¶
Click to show internal directories.
Click to hide internal directories.