Documentation ¶
Index ¶
- Variables
- func DefaultErrorHandler(encoding Encoding[Error]) func(err error) http.Handler
- func New[R Resource, Q Query, P PUintKey](store Store[R, Q, P]) http.Handler
- func NewS[R Resource, Q Query, P PStrKey](store Store[R, Q, P]) http.Handler
- func StrPath[P PStrKey](s string) (P, error)
- func UintPath[P PUintKey](s string) (P, error)
- type AfterCreate
- type AfterDelete
- type AfterList
- type AfterRead
- type AfterUpdate
- type BeforeCreate
- type BeforeDelete
- type BeforeList
- type BeforeRead
- type BeforeUpdate
- type Encoding
- type Error
- type Ghost
- type Handler
- type Identifier
- type JSON
- type PKey
- type PStrKey
- type PUintKey
- type PathIdentifier
- type Querier
- type Query
- type QueryParser
- type Resource
- type Server
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMethodNotAllowed = Error{ Code: http.StatusMethodNotAllowed, Err: errors.New(http.StatusText(http.StatusMethodNotAllowed)), }
View Source
var ErrNotFound = Error{ Code: http.StatusNotFound, Err: errors.New(http.StatusText(http.StatusNotFound)), }
Functions ¶
func DefaultErrorHandler ¶
Types ¶
type AfterCreate ¶
type BeforeCreate ¶
type BeforeRead ¶
type Error ¶
func (Error) MarshalJSON ¶
type Ghost ¶
type JSON ¶
type JSON[R Resource] struct{}
JSON is an Encoding.
func (JSON[R]) EncodeEmpty ¶
func (j JSON[R]) EncodeEmpty(w http.ResponseWriter, code int) error
func (JSON[R]) EncodeList ¶
func (j JSON[R]) EncodeList(w http.ResponseWriter, rs []R, code int) error
type PKey ¶
type PKey interface { comparable }
type PStrKey ¶
type PStrKey interface { comparable string }
type PathIdentifier ¶
PathIdentifier is an Identifier which extracts the PKey from the request URL path.
type QueryParser ¶
type QueryParser[Q Query] struct { // contains filtered or unexported fields }
QueryParser is a Querier which maps the URL query parameters to a Query.
func NewQueryParser ¶
func NewQueryParser[Q Query]() QueryParser[Q]
type Server ¶
type Server interface { Create(http.ResponseWriter, *http.Request) error Read(http.ResponseWriter, *http.Request) error Update(http.ResponseWriter, *http.Request) error Delete(http.ResponseWriter, *http.Request) error List(http.ResponseWriter, *http.Request) error }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.