Versions in this module Expand all Collapse all v0 v0.0.2 Nov 24, 2021 v0.0.1 Nov 24, 2021 Changes in this version + var ErrAlreadyExists = errors.New("already exists") + var ErrForbidden = errors.New("forbidden") + var ErrJsonContentType = errors.New("Content-Type is not application/json") + var ErrJsonHTTPMethod = errors.New("HTTP method does not have a body") + var ErrNotFound = errors.New("not found") + var ErrSchemaDecode = errors.New("failed to decode values") + var ErrUnauthorized = errors.New("unauthorized") + var ErrUnknown = errors.New("unknown error") + func Base32String(p []byte) string + func ConvertStormError(err error) error + func CurrentTime(next http.Handler) http.Handler + func DefaultTokenGenerator() string + func HTTPError(w http.ResponseWriter, code int) + func JsonRequest(r *http.Request, p interface{}) error + func JsonResponse(w http.ResponseWriter, ctx context.Context, p interface{}) + func Logger(logger zerolog.Logger) func(http.Handler) http.Handler + func MustJsonMarshalToBuffer(t *testing.T, p interface{}) *bytes.Buffer + func NewToken(n int) []byte + func RunCase(t *testing.T, label interface{}, f func(t *testing.T)) + func UseBadger(ctx context.Context) *badger.DB + func UseLogger(ctx context.Context) *zerolog.Logger + func UseStorm(ctx context.Context) *storm.DB + func UseTime(ctx context.Context) time.Time + func Validate(p interface{}) error + func ValidateQuery(p interface{}, v url.Values) error + func WithBadger(ctx context.Context, db *badger.DB) context.Context + func WithDriverTokenGenerator(ctx context.Context, gen TokenGenerator) context.Context + func WithStorm(ctx context.Context, db *storm.DB) context.Context + func WithTime(ctx context.Context, t time.Time) context.Context + type Adaptor zerolog.Logger + func (adaptor Adaptor) Debugf(format string, args ...interface{}) + func (adaptor Adaptor) Errorf(format string, args ...interface{}) + func (adaptor Adaptor) Infof(format string, args ...interface{}) + func (adaptor Adaptor) Warningf(format string, args ...interface{}) + type AppContextKey string + const BadgerContextKey + const DriverTokenGeneratorContextKey + const StormContextKey + var TimeContextKey AppContextKey = "time" + type CustomValidator interface + Validate func() error + type Middleware func(next http.Handler) http.Handler + func Badger(db *badger.DB) Middleware + func DriverTokenGenerator(gen TokenGenerator) Middleware + func Storm(path string, opts ...func(*storm.Options) error) Middleware + type TokenGenerator func() string + func UseDriverTokenGenerator(ctx context.Context) TokenGenerator + type ValidationError []validator.FieldError + func (err ValidationError) Error() string