Documentation
¶
Index ¶
- Variables
- func ContextTimeout(timeout time.Duration) echo.MiddlewareFunc
- func NewEcho() (*echo.Echo, func() error)
- func NewValidator(v *validatorV10.Validate) (*validator.DefaultValidator, error)
- type Bean
- func (b *Bean) CleanupDB() error
- func (b *Bean) DefaultHTTPErrorHandler() echo.HTTPErrorHandler
- func (b *Bean) InitDB() error
- func (b *Bean) ServeAt(host, port string) error
- func (b *Bean) Shutdown() error
- func (b *Bean) ShutdownAll() error
- func (b *Bean) UseErrorHandlerFuncs(errHdlrFuncs ...berror.ErrorHandlerFunc)
- func (b *Bean) UseMiddlewares(middlewares ...echo.MiddlewareFunc)
- func (b *Bean) UseValidation(validateFuncs ...validator.ValidatorFunc)
- type DBDeps
Constants ¶
This section is empty.
Variables ¶
var NetHttpFastTransporter *http.Transport
Support a DNS cache version of the net/http Transport.
var TenantAlterDbHostParam string
If a command or service wants to use a different `host` parameter for tenant database connection then it's easy to do just by passing that parameter string name using `bean.TenantAlterDbHostParam`. Therfore, `bean` will overwrite all host string in `TenantConnections`.`Connections` JSON.
Functions ¶
func ContextTimeout ¶
func ContextTimeout(timeout time.Duration) echo.MiddlewareFunc
ContextTimeout return custom context timeout middleware
func NewValidator ¶
func NewValidator(v *validatorV10.Validate) (*validator.DefaultValidator, error)
NewValidator creates a new validator instance. Currently, it only supports a default validator.
Types ¶
type Bean ¶
type Bean struct {
DBConn *DBDeps
Echo *echo.Echo
BeforeServe func()
ShutdownSrv []func() error
CleanupDBs []func() error
Validate *validatorV10.Validate
Config config.Config
// contains filtered or unexported fields
}
func (*Bean) DefaultHTTPErrorHandler ¶
func (b *Bean) DefaultHTTPErrorHandler() echo.HTTPErrorHandler
func (*Bean) InitDB ¶
InitDB initialize all the database dependencies and store it in global variable `global.DBConn`.
func (*Bean) ShutdownAll ¶
ShutdownAll closes all the server and database related resources.
func (*Bean) UseErrorHandlerFuncs ¶
func (b *Bean) UseErrorHandlerFuncs(errHdlrFuncs ...berror.ErrorHandlerFunc)
func (*Bean) UseMiddlewares ¶
func (b *Bean) UseMiddlewares(middlewares ...echo.MiddlewareFunc)
func (*Bean) UseValidation ¶
func (b *Bean) UseValidation(validateFuncs ...validator.ValidatorFunc)
type DBDeps ¶
type DBDeps struct {
MasterMySQLDB *gorm.DB
MasterMySQLDBName string
TenantMySQLDBs map[uint64]*gorm.DB
TenantMySQLDBNames map[uint64]string
MasterMongoDB *mongo.Client
MasterMongoDBName string
TenantMongoDBs map[uint64]*mongo.Client
TenantMongoDBNames map[uint64]string
MasterRedisDB *dbdrivers.RedisDBConn
TenantRedisDBs map[uint64]*dbdrivers.RedisDBConn
MemoryDB memory.Cache
}
All database connections are initialized using `DBDeps` structure.
Directories
¶
| Path | Synopsis |
|---|---|
|
Safe way to execute `go routine` without crashing the parent process while having a `panic`.
|
Safe way to execute `go routine` without crashing the parent process while having a `panic`. |
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
bean
command
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
internal
|
|
|
url
Package urlpath matches paths against a template.
|
Package urlpath matches paths against a template. |
|
Do not change this file.
|
Do not change this file. |
|
store
|
|
|
Package sync provides ways to execute multiple tasks concurrently while synchronously managing them at the same time.
|
Package sync provides ways to execute multiple tasks concurrently while synchronously managing them at the same time. |
|
package test temporarily contains all commonly used, generic utils for testing.
|
package test temporarily contains all commonly used, generic utils for testing. |