Documentation ¶
Index ¶
- Variables
- func BFEDB(db ...*sql.DB) (*sql.DB, error)
- func CloseLog()
- func DbGet(name string) (*sql.DB, error)
- func Exit(topic string, err error, code int)
- func InitI18n(i18nConfig []*I18nConfig) error
- func LoadConfig(file string) error
- func NewBFEDBContext(ctx context.Context, ops ...*lib.Op) (*lib.DBContext, error)
- func NewDB(dbConfig *DbConfig) (*sql.DB, error)
- func NewMonitorServerWithRun(version string, port int) *web_monitor.MonitorServer
- func TryMappingErrMsg(req *http.Request, errMsg string) string
- type Config
- type DbConfig
- type DependsConfig
- type I18nConfig
- type LangMapping
- type LoggerConfig
- type NavTree
- type RunTimeConfig
- type SQLRecord
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( BFEProductID int64 = 1 IgnoreBNSStatusCheck bool )
View Source
var ( SQLLogger log4go.Logger AccessLogger log4go.Logger )
View Source
var ( MetricAPICostHisCounter = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "api_cost", }, []string{"pattern", "status_code", "method"}) MetricAPIAccessCounter = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "api_access", }, []string{"pattern", "status_code", "method"}) MetricSQLCostCounter = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "sql_cost", }, []string{"sql"}) MetricSQLAccessCounter = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "sql_access", }, []string{"sql"}) MetricPaincCounter = prometheus.NewCounter(prometheus.CounterOpts{ Name: "panic", }) )
View Source
var DBs map[string]*sql.DB
Functions ¶
func InitI18n ¶
func InitI18n(i18nConfig []*I18nConfig) error
func LoadConfig ¶
func NewBFEDBContext ¶
func NewMonitorServerWithRun ¶
func NewMonitorServerWithRun(version string, port int) *web_monitor.MonitorServer
Types ¶
type Config ¶
type Config struct { Server ServerConfig Loggers map[string]*LoggerConfig `validate:"dive"` Databases map[string]*DbConfig `validate:"dive"` Depends DependsConfig RunTime RunTimeConfig Vars map[string]string LogDir string ConfigDir string }
var DefaultConfig *Config
type DependsConfig ¶
type DependsConfig struct { I18nDir string `validate:"required,min=1"` UIIcon string UILogo string // contains filtered or unexported fields }
func (*DependsConfig) Init ¶
func (d *DependsConfig) Init() error
func (*DependsConfig) Role2Nav ¶
func (dc *DependsConfig) Role2Nav() map[string]*NavTree
type I18nConfig ¶
type LangMapping ¶
func NewLangMapping ¶
func NewLangMapping(from, to string) (*LangMapping, error)
type LoggerConfig ¶
type LoggerConfig struct { LogName string `validate:"required,min=1"` LogLevel string `validate:"required,oneof=DEBUG TRACE INFO WARNING ERROR CRITICAL"` RotateWhen string `validate:"required,oneof=M H D MIDNIGHT"` // rotate time BackupCount int `validate:"required,min=1"` // backup files Format string StdOut bool }
type RunTimeConfig ¶
type SQLRecord ¶
func (*SQLRecord) UpdateMonitor ¶
func (sr *SQLRecord) UpdateMonitor()
type ServerConfig ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.