Documentation ¶
Index ¶
- Variables
- func ChainMiddlewares(hdl http.Handler, mds ...func(http.Handler) http.Handler) http.Handler
- func WithContextKey(key any, val any) func(http.Handler) http.Handler
- func WithLogRequest(logger models.Logger) func(http.Handler) http.Handler
- func WithoutPanic(logger models.Logger) func(http.Handler) http.Handler
- type Book
- func (b Book) AddToFavorites(rw http.ResponseWriter, req *http.Request)
- func (b Book) AddToWishlist(rw http.ResponseWriter, req *http.Request)
- func (b Book) Create(rw http.ResponseWriter, req *http.Request)
- func (b Book) Download(rw http.ResponseWriter, req *http.Request)
- func (b Book) Find(rw http.ResponseWriter, req *http.Request)
- func (b Book) FindMany(rw http.ResponseWriter, req *http.Request)
- func (b Book) Route(rtr chi.Router)
- type BookLogic
- type Reader
- func (r Reader) Login(rw http.ResponseWriter, req *http.Request)
- func (r Reader) Logout(rw http.ResponseWriter, req *http.Request)
- func (r Reader) Refresh(rw http.ResponseWriter, req *http.Request)
- func (r Reader) Register(rw http.ResponseWriter, req *http.Request)
- func (r Reader) Route(rtr chi.Router)
- type ReaderLogic
- type Router
- type Server
- type Token
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDecoding = errors.New("error decoding data from request")
View Source
var ErrEncoding = errors.New("error encoding data to buffer")
View Source
var ErrInvalidData = errors.New("invalid data, expected nil")
View Source
var ErrInvalidQuery = errors.New("invalid query")
View Source
var ErrNotAuthorized = errors.New("not authorized")
View Source
var ErrPermissions = errors.New("error permissions")
View Source
var ErrWritingResponse = errors.New("error writing response from buffer")
Functions ¶
func ChainMiddlewares ¶
func WithContextKey ¶
WithContextKey wraps key/val pairs into request context.
func WithLogRequest ¶
WithLogRequest logs every request and sends logger instance to further handler.
Types ¶
type Book ¶
type Book struct {
// contains filtered or unexported fields
}
func (Book) AddToFavorites ¶
func (b Book) AddToFavorites(rw http.ResponseWriter, req *http.Request)
func (Book) AddToWishlist ¶
func (b Book) AddToWishlist(rw http.ResponseWriter, req *http.Request)
func (Book) FindMany ¶
func (b Book) FindMany(rw http.ResponseWriter, req *http.Request)
FindMany handles bulk fetching books by given OData query. If $top number not specified maxOnPage will be used. In case number of requested books is more than maxOnPage then nextLink will be rendered in response.
type BookLogic ¶
type BookLogic interface { Import(context.Context, models.Book) error Fetch(context.Context, models.Book) (models.Book, error) FetchMany(context.Context, models.DataFilter) ([]models.Book, error) ExportToCSV(context.Context, models.DataFilter) ([]byte, error) AddToFavorites(context.Context, models.Reader, models.Book) error AddToWishlist(context.Context, models.Reader, models.Book) error }
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func (Reader) Login ¶
func (r Reader) Login(rw http.ResponseWriter, req *http.Request)
Login handles authorization process of created models.Reader.
func (Reader) Logout ¶
func (r Reader) Logout(rw http.ResponseWriter, req *http.Request)
Logout handles logout process.
func (Reader) Refresh ¶
func (r Reader) Refresh(rw http.ResponseWriter, req *http.Request)
Refresh handles process of token pair refreshment.
type ReaderLogic ¶
type ReaderLogic interface { Auth(context.Context, models.AccessToken) error Refresh(context.Context, models.RefreshToken) (*models.TokenPair, error) SignUp(context.Context, models.Reader) error SignIn(context.Context, models.Credentials) (*models.TokenPair, error) SignOut(context.Context, models.AccessToken) error }
type Token ¶
type Token interface { models.AccessToken | models.RefreshToken }
Click to show internal directories.
Click to hide internal directories.