g

package
v0.0.0-...-7a70599 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version    string = "v0.1"
	BinaryName string = "ops-hbs.dev"
)
View Source
var (
	ConfigFile string
)

Functions

func DB

func DB() *gorm.DB

获取db实例

func HbsInfo

func HbsInfo() string

func InitAll

func InitAll()

func InitConfig

func InitConfig()

func InitDB

func InitDB()

初始化数据库连接

func InitLog

func InitLog()

func InitRuntime

func InitRuntime()

func MemMonitor

func MemMonitor()

func ReloadConfig

func ReloadConfig() error

func Shutdown

func Shutdown(ctx context.Context) error

func Validator

func Validator() error

func VersionInfo

func VersionInfo() string

Types

type DatabaseConfig

type DatabaseConfig struct {
	Host     string `json:"host"`
	User     string `json:"user"`
	Password string `json:"password"`
	Port     int    `json:"port"`
	Db       string `json:"db"`
	MaxConn  int    `json:"max_conn"`
	MaxIdle  int    `json:"max_idle"`
}

type GlobalConfig

type GlobalConfig struct {
	Debug      bool            `json:"debug"`
	Log        *LogConfig      `json:"log"`
	Database   *DatabaseConfig `json:"database"`
	Rpc        *RpcConfig      `json:"rpc"`
	Http       *HttpConfig     `json:"http"`
	MaxCPURate float64         `json:"max_cpu_rate"`
	MaxMemRate float64         `json:"max_mem_rate"`
}

func Conf

func Conf() *GlobalConfig

type HttpConfig

type HttpConfig struct {
	Enabled bool   `json:"enabled"`
	Listen  string `json:"listen"`
}

type LogConfig

type LogConfig struct {
	LogPath      string `json:"log_path"`
	LogLevel     string `json:"log_level"`
	LogFileName  string `json:"log_file_name"`
	LogKeepHours int    `json:"log_keep_hours"`
}

type RpcConfig

type RpcConfig struct {
	Enabled bool   `json:"enabled"`
	Listen  string `json:"listen"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL