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, doc interface{}) error
- func (h *HandlerBase) Find(c echo.Context, projection, docs interface{}) error
- func (h *HandlerBase) FindOne(c echo.Context, projection interface{}, doc interface{}) error
- func (h *HandlerBase) Head(c echo.Context, f interface{}) error
- func (h *HandlerBase) Init(db db.DatabaseBase, collection string, repo RepositoryInterface)
- func (h *HandlerBase) Insert(c echo.Context, doc interface{}) error
- func (h *HandlerBase) UpdateOne(c echo.Context, doc interface{}) error
- type JWTConfig
- type LifeCycle
- type MiddlewareHandler
- type RepositoryBase
- func (r *RepositoryBase) Aggregate(params filter.Params, ctx context.Context, pipeline, docs interface{}) (int64, error)
- func (r *RepositoryBase) AggregateOne(params filter.Params, ctx context.Context, pipeline interface{}, ...) error
- func (r *RepositoryBase) DeleteOne(params filter.Params, ctx context.Context, filter interface{}) (interface{}, error)
- func (r *RepositoryBase) EnsureIndexs()
- func (r *RepositoryBase) Find(params filter.Params, ctx context.Context, filter interface{}, ...) (int64, error)
- func (r *RepositoryBase) FindOne(params filter.Params, ctx context.Context, filter, projection interface{}, ...) error
- func (r *RepositoryBase) Head(params filter.Params, ctx context.Context, filter interface{}) int64
- func (r *RepositoryBase) Init(db db.DatabaseBase, collection string)
- func (r *RepositoryBase) Insert(params filter.Params, ctx context.Context, doc interface{}, ...) (interface{}, error)
- func (r *RepositoryBase) RegisterLifeCycle(l LifeCycle)
- func (r *RepositoryBase) UpdateOne(params filter.Params, ctx context.Context, filter, doc interface{}, ...) (interface{}, error)
- 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, doc interface{}) error
func (*HandlerBase) Find ¶
func (h *HandlerBase) Find(c echo.Context, projection, docs interface{}) error
func (*HandlerBase) FindOne ¶
func (h *HandlerBase) FindOne(c echo.Context, projection interface{}, doc interface{}) error
func (*HandlerBase) Head ¶
func (h *HandlerBase) Head(c echo.Context, f interface{}) error
/ Find one document without body
func (*HandlerBase) Init ¶
func (h *HandlerBase) Init(db db.DatabaseBase, collection string, repo RepositoryInterface)
func (*HandlerBase) Insert ¶
func (h *HandlerBase) Insert(c echo.Context, doc interface{}) error
func (*HandlerBase) UpdateOne ¶
func (h *HandlerBase) UpdateOne(c echo.Context, 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(params filter.Params, filter *interface{}, option *db.FindOption, projection interface{}) error AfterFind func(params filter.Params, docs interface{}) error BeforeFindOne func(params filter.Params, filter, projection interface{}) error AfterFindOne func(params filter.Params, doc interface{}) error BeforeInsert func(params filter.Params, doc interface{}) error AfterInsert func(params filter.Params, doc interface{}) error BeforeUpdateOne func(params filter.Params, filter, doc interface{}) error AfterUpdateOne func(params filter.Params, doc interface{}) error BeforeDeleteOne func(params filter.Params, filter interface{}) error AfterDeleteOne func(params filter.Params, doc interface{}) error }
type MiddlewareHandler ¶
type MiddlewareHandler func(next echo.HandlerFunc, c echo.Context) error
type RepositoryBase ¶
type RepositoryBase struct { Driver db.DatabaseBase // contains filtered or unexported fields }
func (*RepositoryBase) AggregateOne ¶ added in v0.2.4
func (*RepositoryBase) EnsureIndexs ¶ added in v0.2.4
func (r *RepositoryBase) EnsureIndexs()
func (*RepositoryBase) Find ¶ added in v0.2.4
func (r *RepositoryBase) Find(params filter.Params, ctx context.Context, filter interface{}, option db.FindOption, projection, docs interface{}) (int64, error)
func (*RepositoryBase) Init ¶
func (r *RepositoryBase) Init(db db.DatabaseBase, collection string)
func (*RepositoryBase) RegisterLifeCycle ¶ added in v0.2.4
func (r *RepositoryBase) RegisterLifeCycle(l LifeCycle)
type RepositoryInterface ¶
type RepositoryInterface interface { EnsureIndexs() Init(db db.DatabaseBase, collection string) RegisterLifeCycle(l LifeCycle) Find(params filter.Params, ctx context.Context, filter interface{}, option db.FindOption, projection, docs interface{}) (int64, error) FindOne(params filter.Params, ctx context.Context, filter, projection interface{}, doc interface{}) error Aggregate(params filter.Params, ctx context.Context, pipeline, docs interface{}) (int64, error) AggregateOne(params filter.Params, ctx context.Context, pipeline interface{}, doc interface{}) error Head(params filter.Params, ctx context.Context, filter interface{}) int64 Insert(params filter.Params, ctx context.Context, doc interface{}, validateFunc func(interface{}) error) (interface{}, error) UpdateOne(params filter.Params, ctx context.Context, filter, doc interface{}, validateFunc func(interface{}) error) (interface{}, error) DeleteOne(params filter.Params, ctx context.Context, filter interface{}) (interface{}, error) }
type RouterBase ¶
type RouterBase interface { Init(e *echo.Echo, db db.DatabaseBase) GetRepository() RepositoryInterface }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.