config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: MulanPSL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// k8s的容器环境变量
	K8S_ENV_TEST = "test"
	K8S_ENV_PRE  = "pre"
	K8S_ENV_PROD = "production"
	RUN_ENV      = "run_env"
)
View Source
const (
	// 分页参数
	PAGE_MIN      = 1
	PAGE_SIZE_MAX = 20
)
View Source
const (
	INVALID_PARAMS = "invalidParams"
	SUCCESS        = "success"
	FAIL           = "failed"
	NONE_LOGIN     = "nonLogin"
)
View Source
const (
	TIMEOUT_MILLISECOND_50   = 50 * time.Millisecond
	TIMEOUT_MILLISECOND_60   = 60 * time.Millisecond
	TIMEOUT_MILLISECOND_100  = 100 * time.Millisecond
	TIMEOUT_MILLISECOND_120  = 120 * time.Millisecond
	TIMEOUT_MILLISECOND_140  = 140 * time.Millisecond
	TIMEOUT_MILLISECOND_150  = 150 * time.Millisecond
	TIMEOUT_MILLISECOND_200  = 200 * time.Millisecond
	TIMEOUT_MILLISECOND_280  = 280 * time.Millisecond
	TIMEOUT_MILLISECOND_290  = 290 * time.Millisecond
	TIMEOUT_MILLISECOND_300  = 300 * time.Millisecond
	TIMEOUT_MILLISECOND_450  = 450 * time.Millisecond
	TIMEOUT_MILLISECOND_1000 = time.Second
	TIMEOUT_MILLISECOND_3000 = 3 * time.Second
	TIMEOUT_MILLISECOND_5000 = 5 * time.Second
)

Variables

This section is empty.

Functions

func FileExists

func FileExists(filename string) bool

FileExists检查某个文件路径是否存在

func IsDev

func IsDev() bool

func IsOnline

func IsOnline() bool

func IsPre

func IsPre() bool

func IsTest

func IsTest() bool

Types

type AppConfiguration

type AppConfiguration struct {
	// app名称
	AppName string `yaml:"appName"`
	// listen addr
	Listen   string   `yaml:"listen"`
	LogConf  LogConf  `yaml:"log"`
	DbConf   DbConf   `yaml:"db"`
	KvDbConf KvDbConf `yaml:"kvdb"`
}
var AppConfig *AppConfiguration

func ParseConfig

func ParseConfig(file string) *AppConfiguration

type DbConf

type DbConf struct {
	DefaultMasterDsn  string `yaml:"defaultMasterDsn"`
	DefaultMasterIdle int    `yaml:"defaultMasterIdle"`
	DefaultMasterOpen int    `yaml:"defaultMasterOpen"`
	DefaultSlaveDsn   string `yaml:"defaultSlaveDsn"`
	DefaultSlaveIdle  int    `yaml:"defaultSlaveIdle"`
	DefaultSlaveOpen  int    `yaml:"defaultSlaveOpen"`
}

type DefaultJson

type DefaultJson struct {
	Status  string      `json:"status"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

DefaultJson是返回的默认json格式

type KvDbConf

type KvDbConf struct {
	KvMasterDsn  string `yaml:"kvMasterDsn"`
	KvMasterIdle int    `yaml:"kvMasterIdle"`
	KvMasterOpen int    `yaml:"kvMasterOpen"`
	KvSlaveDsn   string `yaml:"kvSlaveDsn"`
	KvSlaveIdle  int    `yaml:"kvSlaveIdle"`
	KvSlaveOpen  int    `yaml:"kvSlaveOpen"`
}

type LogConf

type LogConf struct {
	Default    LogDetail `yaml:"default"`
	Trace      LogDetail `yaml:"trace"`
	BackupNum  int       `yaml:"backup_num"`
	MaxSize    int       `yaml:"max_size"`
	RetainDays int       `yaml:"retain_days"`
}

type LogDetail

type LogDetail struct {
	Level      string `yaml:"level"`
	File       string `yaml:"file"`
	BackupNum  int    `yaml:"backup_num"`
	MaxSize    int    `yaml:"max_size"`
	RetainDays int    `yaml:"retain_days"`
}

Jump to

Keyboard shortcuts

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