goconf

package module
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2021 License: BSD-2-Clause Imports: 30 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

View Source
var LocationIP string

LocationIP 本地ip

Functions

func Execute added in v0.0.10

func Execute(table string, sql string, values []interface{}, db *sql.DB) (int64, error)

Execute sql 执行

func ExecuteSQL added in v0.0.10

func ExecuteSQL(table string, sets map[string]interface{}, db *sql.DB) (int64, error)

ExecuteSQL sql转换

func FormatUpdateSQL added in v0.0.10

func FormatUpdateSQL(sets map[string]interface{}, where map[string]interface{})

FormatUpdateSQL 整理uppdate的sql语句

func Get added in v0.0.9

func Get(url string) ([]byte, error)

Get 用途,封装好对应的get 和post请求

func GetInsertSQL added in v0.0.10

func GetInsertSQL(table string, sets map[string]interface{}) string

GetInsertSQL 获取sql

func GetLogPath added in v0.0.5

func GetLogPath() string

GetLogPath 获取日志路径

func GetSSHConfig added in v0.0.12

func GetSSHConfig() *sshConfig

GetSSHConfig 获取ssh 配置

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(key string) *redis.Pool

InitRedisConfDb 初始化redis

func NewLoger added in v0.0.5

func NewLoger(path string) *zap.Logger

NewLoger 初始化

func PostData added in v0.0.9

func PostData(url string, b string) ([]byte, error)

PostData 提交post json,b= name=cjb url(url,"name=cjb")

func PostForm added in v0.0.9

func PostForm(urlx string, b url.Values) ([]byte, error)

PostForm 提交post 表单

func PostJSON added in v0.0.9

func PostJSON(url string, b []byte) ([]byte, error)

PostJSON 提交post json

func ReadCsv added in v0.0.8

func ReadCsv(path string, message chan []string, midf func([]string, int), end func(int), fNum int) error

ReadCsv csv 文件读取

func ReadCsvWorker added in v0.0.8

func ReadCsvWorker(path string, midf func([]string, int), endf func(int), fNum int, worker func(chan []string, *sync.WaitGroup), workerNumber int) error

ReadCsvWorker 读取文件,并且有worker 消耗文件 path 文件路径 midf 读取函数中间操作, fNum读取多少个文件执行f函数 worker 工作池 ,workerNumber 工作池数量

func RegisterDialContext added in v0.0.12

func RegisterDialContext()

Types

type Client added in v0.0.12

type Client struct {
	// contains filtered or unexported fields
}

func Dial added in v0.0.12

func Dial(network, addr string, config *ssh.ClientConfig) (*Client, error)

Dial starts a client connection to the given SSH server. This is wrap the ssh.Dial

func DialWithKey added in v0.0.12

func DialWithKey(addr, user, keyfile string) (*Client, error)

DialWithKey starts a client connection to the given SSH server with key authmethod.

func DialWithKeyWithPassphrase added in v0.0.12

func DialWithKeyWithPassphrase(addr, user, keyfile string, passphrase string) (*Client, error)

DialWithKeyWithPassphrase same as DialWithKey but with a passphrase to decrypt the private key

func DialWithPasswd added in v0.0.12

func DialWithPasswd(addr, user, passwd string) (*Client, error)

DialWithPasswd starts a client connection to the given SSH server with passwd authmethod.

func (*Client) Close added in v0.0.12

func (c *Client) Close() error

func (*Client) Cmd added in v0.0.12

func (c *Client) Cmd(cmd string) *remoteScript

Cmd create a command on client

func (*Client) Script added in v0.0.12

func (c *Client) Script(script string) *remoteScript

Script

func (*Client) ScriptFile added in v0.0.12

func (c *Client) ScriptFile(fname string) *remoteScript

ScriptFile

func (*Client) Shell added in v0.0.12

func (c *Client) Shell() *remoteShell

Shell create a noninteractive shell on client.

func (*Client) Terminal added in v0.0.12

func (c *Client) Terminal(config *TerminalConfig) *remoteShell

Terminal create a interactive shell on client.

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 获取配置文件

type LoggerItem added in v0.0.7

type LoggerItem struct {
	// contains filtered or unexported fields
}

LoggerItem 容量切割

func NewLoggerItem added in v0.0.7

func NewLoggerItem(Filename string) *LoggerItem

NewLoggerItem 创建日志工具

func (*LoggerItem) ERROR added in v0.0.7

func (c *LoggerItem) ERROR(mark string, brief string, msg string)

ERROR warn

func (*LoggerItem) Error added in v0.0.7

func (c *LoggerItem) Error(err interface{}, funcName string, args ...interface{})

Error 打印错误日志

func (*LoggerItem) Errorf added in v0.0.7

func (c *LoggerItem) Errorf(args ...interface{})

Errorf 打印错误日志

func (*LoggerItem) INFO added in v0.0.7

func (c *LoggerItem) INFO(mark string, brief string, msg string)

INFO info信息打印

func (*LoggerItem) Infof added in v0.0.7

func (c *LoggerItem) Infof(args ...interface{})

Infof 打印普通日志

func (*LoggerItem) WARN added in v0.0.7

func (c *LoggerItem) WARN(mark string, brief string, msg string)

WARN warn

func (*LoggerItem) Warnf added in v0.0.7

func (c *LoggerItem) Warnf(args ...interface{})

Warnf 打印错误日志

type LoggerTools added in v0.0.7

type LoggerTools struct {
	// contains filtered or unexported fields
}

LoggerTools 日志工具

func NewLoggerTools added in v0.0.7

func NewLoggerTools(path string) *LoggerTools

NewLoggerTools log 初始化

func (*LoggerTools) ERROR added in v0.0.7

func (c *LoggerTools) ERROR(mark string, brief string, msg string)

ERROR error打印

func (*LoggerTools) INFO added in v0.0.7

func (c *LoggerTools) INFO(mark string, brief string, msg string)

INFO info打印

func (*LoggerTools) WARN added in v0.0.7

func (c *LoggerTools) WARN(mark string, brief string, msg string)

WARN 告警打印

type MongoConf added in v0.0.6

type MongoConf struct {
	MongoURL string
	Auth     int
	User     string
	Pwd      string
}

MongoConf mongo 配置文件

func NewMongoConf added in v0.0.6

func NewMongoConf(key string) *MongoConf

NewMongoConf 获取mongo conf

type MysqlConf added in v0.0.6

type MysqlConf struct {
	DbURL    string
	LifeTime int
	IdleConn int
	OpenConn int
}

MysqlConf 配置

func NewMysqlConf added in v0.0.6

func NewMysqlConf(key string) *MysqlConf

NewMysqlConf mysql配置

type RedisConf added in v0.0.6

type RedisConf struct {
	URL           string
	Pwd           string
	MaxIdle       int
	MaxActivePool int
	DB            int
}

RedisConf redis配置信息

func NewRedisConf added in v0.0.6

func NewRedisConf(key string) *RedisConf

NewRedisConf redis配置初始化

type TerminalConfig added in v0.0.12

type TerminalConfig struct {
	Term   string
	Height int
	Weight int
	Modes  ssh.TerminalModes
}

type ViaSSHDialer added in v0.0.12

type ViaSSHDialer struct {
	// contains filtered or unexported fields
}

func NewViaSSHDialer added in v0.0.12

func NewViaSSHDialer(client *ssh.Client) *ViaSSHDialer

func (*ViaSSHDialer) Dial added in v0.0.12

func (self *ViaSSHDialer) Dial(context context.Context, addr string) (net.Conn, error)

Jump to

Keyboard shortcuts

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