goconf

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: BSD-2-Clause Imports: 18 Imported by: 0

README

配置文件使用

该项目的目的是方便后续使用到初始化 配置文件的问题上面的使用 方便配置文件的管理和使用

如何使用呢?
项目下面有 resource 目录
app.conf 指定了使用哪个环境变量

resource 目录下包含 app.conf 和 app-xxx.conf
app.conf  下面的内容 确保使用了哪个配置环境  
[app]  
app=test  

// how to use // parse := NewConfigParse()
// iniconf = parse.GetConfig()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogPath added in v0.0.5

func GetLogPath() string

GetLogPath 获取日志路径

func InitGorm

func InitGorm(key string) *gorm.DB

InitGorm 初始化

func InitMgo

func InitMgo(key string) *mgo.Session

InitMgo 对mongodb的初始化 第三方库

func InitMongo

func InitMongo(key string) *mongo.Client

InitMongo 初始化 官方库;暂时只支持单个mongo

func InitMysql

func InitMysql(key string) *sql.DB

InitMysql 初始化mysql

func InitRedis

func InitRedis(key string, db int) *redis.Pool

InitRedis 初始化redis

func InitRedis1

func InitRedis1(key string, db int) *redisv7.Client

InitRedis1 初始化redis

func InitRedis1ConfDb

func InitRedis1ConfDb(key string) *redisv7.Client

InitRedis1ConfDb 初始化redis

func InitRedisConfDb

func InitRedisConfDb(redisKey string) *redis.Pool

InitRedisConfDb 初始化redis

func NewLoger added in v0.0.5

func NewLoger(path string) *zap.Logger

NewLoger 初始化

Types

type ConfigParse

type ConfigParse struct {
	Path      string
	NowConfig *ini.File
	Env       string
}

ConfigParse 配置环境

func NewConfigParse

func NewConfigParse(Path string) *ConfigParse

NewConfigParse 初始化

func (*ConfigParse) GetConfig

func (c *ConfigParse) GetConfig() *ini.File

GetConfig 获取配置文件

Jump to

Keyboard shortcuts

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