Documentation ¶
Overview ¶
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. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Constants
- Variables
- func DefaultBeforeBreadcrumb(breadcrumb *sentry.Breadcrumb, hint *sentry.BreadcrumbHint) *sentry.Breadcrumb
- func DefaultBeforeSend(event *sentry.Event, hint *sentry.EventHint) *sentry.Event
- func Logger() echo.Logger
- func NewEcho(config Config) *echo.Echo
- func SentryCaptureException(c echo.Context, err error)
- func SentryCaptureMessage(c echo.Context, msg string)
- type Bean
- func (b *Bean) DefaultHTTPErrorHandler() echo.HTTPErrorHandler
- func (b *Bean) InitDB()
- func (b *Bean) ServeAt(host, port string)
- func (b *Bean) UseErrorHandlerFuncs(errHdlrFuncs ...berror.ErrorHandlerFunc)
- func (b *Bean) UseMiddlewares(middlewares ...echo.MiddlewareFunc)
- func (b *Bean) UseValidation(validateFuncs ...validator.ValidatorFunc)
- type Config
- type DBDeps
- type SentryConfig
Constants ¶
const SentryHubContextKey = "sentry"
This key is inherited from `sentryecho` package as the package doesn't support the key for external use.
Variables ¶
var BeanLogger echo.Logger
This is a global variable to hold the debug logger so that we can log data from service, repository or anywhere.
var SentryOn bool
This is a global variable to hold the sentry On/Off setting to check sentry is initialized or not very quickly from handlers/services/repositories.
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 DefaultBeforeBreadcrumb ¶ added in v1.1.18
func DefaultBeforeBreadcrumb(breadcrumb *sentry.Breadcrumb, hint *sentry.BreadcrumbHint) *sentry.Breadcrumb
Modify breadcrumbs through beforeBreadcrumb function.
func DefaultBeforeSend ¶ added in v1.1.18
func DefaultBeforeSend(event *sentry.Event, hint *sentry.EventHint) *sentry.Event
Modify event through beforeSend function.
func Logger ¶ added in v1.1.18
func Logger() echo.Logger
The bean Logger to have debug log from anywhere.
func SentryCaptureException ¶ added in v1.1.19
func SentryCaptureException(c echo.Context, err error)
This is a global function to send sentry exception if you configure the sentry through env.json. You cann pass a proper context or nil.
func SentryCaptureMessage ¶ added in v1.1.19
func SentryCaptureMessage(c echo.Context, msg string)
This is a global function to send sentry message if you configure the sentry through env.json. You cann pass a proper context or nil.
Types ¶
type Bean ¶
type Bean struct { DBConn *DBDeps Echo *echo.Echo BeforeServe func() Config Config // contains filtered or unexported fields }
func (*Bean) DefaultHTTPErrorHandler ¶
func (b *Bean) DefaultHTTPErrorHandler() echo.HTTPErrorHandler
func (*Bean) InitDB ¶
func (b *Bean) InitDB()
InitDB initialize all the database dependencies and store it in global variable `global.DBConn`.
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 Config ¶
type Config struct { ProjectName string Environment string DebugLogPath string Secret string AccessLog struct { On bool BodyDump bool Path string BodyDumpMaskParam []string } Prometheus struct { On bool SkipEndpoints []string } HTTP struct { Port string Host string BodyLimit string IsHttpsRedirect bool Timeout time.Duration KeepAlive bool AllowedMethod []string SSL struct { On bool CertFile string PrivFile string MinTLSVersion uint16 } } HTML struct { ViewsTemplateCache bool } Database struct { Tenant struct { On bool } MySQL dbdrivers.SQLConfig Mongo dbdrivers.MongoConfig Redis dbdrivers.RedisConfig Badger dbdrivers.BadgerConfig } Sentry SentryConfig Security struct { HTTP struct { Header struct { XssProtection string ContentTypeNosniff string XFrameOptions string HstsMaxAge int ContentSecurityPolicy string } } } }
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 map[uint64]*dbdrivers.RedisDBConn TenantRedisDBs map[uint64]*dbdrivers.RedisDBConn BadgerDB *badger.DB }
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
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. |
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. |
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. |
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. |
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. |
Do not change this file.
|
Do not change this file. |
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. |
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. |
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. |