Documentation ¶
Index ¶
- Constants
- func Bind(c echo.Context, doc interface{}) error
- func CacheMiddleware() echo.MiddlewareFunc
- func GetJWTClaims(c echo.Context) jwt.MapClaims
- func GetJWTFromHeader(c echo.Context) (string, error)
- func GetJWTSignedString(data jwt.MapClaims) (string, error)
- func GetRefreshJWTSignedString(data jwt.MapClaims) (string, error)
- func InitCacheMiddleware(capacity int, ttl time.Duration) error
- func InitJWTMiddleware(config JWTConfig) error
- func InitKeyAuthMiddleware(key string) error
- func JWTWithAuthHandler(handler MiddlewareHandler) echo.MiddlewareFunc
- func JWTWithDefault(skipper middleware.Skipper) echo.MiddlewareFunc
- func KeyAuthMiddleware() echo.MiddlewareFunc
- func ParseToken(tokenString string) (*jwt.Token, error)
- type HandlerBase
- func (h *HandlerBase) Aggregate(c echo.Context, pipeline, docs interface{}) error
- func (h *HandlerBase) AggregateOne(c echo.Context, pipeline interface{}, doc interface{}) error
- func (h *HandlerBase) DeleteOne(c echo.Context, filter interface{}) error
- func (h *HandlerBase) Find(c echo.Context, filter interface{}, option db.FindOption, ...) error
- func (h *HandlerBase) FindOne(c echo.Context, filter, projection interface{}, doc interface{}) error
- func (h *HandlerBase) Head(c echo.Context, filter interface{}) error
- func (h *HandlerBase) Init(db db.DatabaseBase, collection string)
- func (h *HandlerBase) Insert(c echo.Context, doc interface{}) error
- func (h *HandlerBase) RegisterLifeCycle(l LifeCycle)
- func (h *HandlerBase) UpdateOne(c echo.Context, filter, doc interface{}) error
- type JWTConfig
- type LifeCycle
- type MiddlewareHandler
- type RepositoryBase
- type RepositoryInterface
- type RouterBase
- type ServerConfig
Constants ¶
View Source
const (
HeaderTotalCount = "X-Total-Count"
)
Variables ¶
This section is empty.
Functions ¶
func Bind ¶
func Bind(c echo.Context, doc interface{}) error
Use this binding instead of Echo.Binding()
func CacheMiddleware ¶
func CacheMiddleware() echo.MiddlewareFunc
https://github.com/Columbus-internet/http-cache/blob/9fc5fbc41c27/cache.go#L94
func GetJWTFromHeader ¶
Extracts token from the request header.
func GetJWTSignedString ¶
JWT signed string
func GetRefreshJWTSignedString ¶
JWT signed string with long expire
func InitKeyAuthMiddleware ¶
func JWTWithAuthHandler ¶
func JWTWithAuthHandler(handler MiddlewareHandler) echo.MiddlewareFunc
func JWTWithDefault ¶
func JWTWithDefault(skipper middleware.Skipper) echo.MiddlewareFunc
func KeyAuthMiddleware ¶
func KeyAuthMiddleware() echo.MiddlewareFunc
func ParseToken ¶
Types ¶
type HandlerBase ¶
type HandlerBase struct {
// contains filtered or unexported fields
}
func (*HandlerBase) Aggregate ¶
func (h *HandlerBase) Aggregate(c echo.Context, pipeline, docs interface{}) error
func (*HandlerBase) AggregateOne ¶
func (h *HandlerBase) AggregateOne(c echo.Context, pipeline interface{}, doc interface{}) error
func (*HandlerBase) DeleteOne ¶
func (h *HandlerBase) DeleteOne(c echo.Context, filter interface{}) error
func (*HandlerBase) Find ¶
func (h *HandlerBase) Find(c echo.Context, filter interface{}, option db.FindOption, projection, docs interface{}) error
func (*HandlerBase) FindOne ¶
func (h *HandlerBase) FindOne(c echo.Context, filter, projection interface{}, doc interface{}) error
func (*HandlerBase) Head ¶
func (h *HandlerBase) Head(c echo.Context, filter interface{}) error
/ Find one document without body
func (*HandlerBase) Init ¶
func (h *HandlerBase) Init(db db.DatabaseBase, collection string)
func (*HandlerBase) Insert ¶
func (h *HandlerBase) Insert(c echo.Context, doc interface{}) error
func (*HandlerBase) RegisterLifeCycle ¶
func (h *HandlerBase) RegisterLifeCycle(l LifeCycle)
func (*HandlerBase) UpdateOne ¶
func (h *HandlerBase) UpdateOne(c echo.Context, filter, doc interface{}) error
type JWTConfig ¶
type JWTConfig struct { // Algorithm: HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384, ES512, None SigningMethod string `yaml:"signingMethod"` // Secrect key SigningKey string `yaml:"signingKey"` // How many ms that token will be expired Expire time.Duration `yaml:"expire"` // How many ms that refresh token will be expired RefreshExpire time.Duration `yaml:"refreshExpire"` }
func GetJWTConfig ¶
func GetJWTConfig() JWTConfig
type LifeCycle ¶
type LifeCycle struct { BeforeFind func(c echo.Context, filter *interface{}, option *db.FindOption, projection interface{}) error AfterFind func(c echo.Context, docs interface{}) error BeforeFindOne func(c echo.Context, filter, projection interface{}) error AfterFindOne func(c echo.Context, doc interface{}) error BeforeInsert func(c echo.Context, doc interface{}) error AfterInsert func(c echo.Context, doc interface{}) error BeforeUpdateOne func(c echo.Context, filter, doc interface{}) error AfterUpdateOne func(c echo.Context, doc interface{}) error BeforeDeleteOne func(c echo.Context, filter interface{}) error AfterDeleteOne func(c echo.Context, doc interface{}) error }
type MiddlewareHandler ¶
type MiddlewareHandler func(next echo.HandlerFunc, c echo.Context) error
type RepositoryBase ¶
type RepositoryBase struct {
Driver db.DatabaseBase
}
func (*RepositoryBase) Init ¶
func (r *RepositoryBase) Init(driver db.DatabaseBase)
type RepositoryInterface ¶
type RepositoryInterface interface {
EnsureIndexs()
}
type RouterBase ¶
type RouterBase interface {
Init(e *echo.Echo, db db.DatabaseBase)
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.