config

package
v0.0.0-...-5a7003e Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2019 License: LGPL-3.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLog

func InitLog(logConf Log) *logs.BeeLogger

func NewGorm

func NewGorm(conf *Config) (*gorm.DB, error)

NewGorm 创建DB实例

Types

type Config

type Config struct {
	Log        Log        `toml:"log"`
	Gorm       Gorm       `toml:"gorm"`
	MySQL      MySQL      `toml:"mysql"`
	HTTP       HTTP       `toml:"http"`
	Redis      Redis      `toml:"redis"`
	FileUpload FileUpload `toml:"fileUpload"`
}

Config 配置参数

func LoadGlobalConfig

func LoadGlobalConfig(path string) (c *Config, err error)

LoadGlobalConfig 加载全局配置

func ParseConfig

func ParseConfig(path string) (*Config, error)

ParseConfig 解析配置文件

type FileUpload

type FileUpload struct {
	BasePath    string `toml:"basePath"`
	Path        string `toml:"path"`
	DoMain      string `toml:"doMain"`
	MaxFileSize int64  `toml:"maxFileSize"`
	ExtFilter   string `toml:"extFilter"`
}

FileUpload 文件上传配置参数

type Gorm

type Gorm struct {
	Debug        bool   `toml:"debug"`
	DBType       string `toml:"db_type"`
	MaxLifetime  int    `toml:"max_lifetime"`
	MaxOpenConns int    `toml:"max_open_conns"`
	MaxIdleConns int    `toml:"max_idle_conns"`
	TablePrefix  string `toml:"table_prefix"`
}

Gorm gorm配置参数

type HTTP

type HTTP struct {
	Host            string `toml:"host"`
	Port            int    `toml:"port"`
	ShutdownTimeout int    `toml:"shutdown_timeout"`
}

HTTP http配置参数

type Log

type Log struct {
	Level    int    `toml:"level"`
	Path     string `toml:"path"`
	MaxDays  int    `toml:"maxdays"`
	Separate string `toml:"separate"`
}

Log 日志配置参数

type MySQL

type MySQL struct {
	Host       string `toml:"host"`
	Port       int    `toml:"port"`
	User       string `toml:"user"`
	Password   string `toml:"password"`
	DBName     string `toml:"db_name"`
	Parameters string `toml:"parameters"`
}

MySQL mysql配置参数

func (MySQL) DSN

func (a MySQL) DSN() string

DSN 数据库连接串

type Redis

type Redis struct {
	Addr         string `toml:"addr"`
	Password     string `toml:"password"`
	Database     int    `toml:"database"`
	MaxOpenConns int    `toml:"maxOpenConns"`
	MaxIdleConns int    `toml:"maxIdleConns"`
}

Redis redis配置参数

type RedisConnPool

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

func InitRedis

func InitRedis(red Redis) *RedisConnPool

func (*RedisConnPool) CheckSETString

func (p *RedisConnPool) CheckSETString(key, value string) (int, error)

func (*RedisConnPool) Close

func (p *RedisConnPool) Close() error

关闭连接池

func (*RedisConnPool) DelKey

func (p *RedisConnPool) DelKey(key string) (interface{}, error)

// Key(键)

func (*RedisConnPool) DelSETKeyValue

func (p *RedisConnPool) DelSETKeyValue(key string, value ...string) (int64, error)

func (*RedisConnPool) Do

func (p *RedisConnPool) Do(command string, args ...interface{}) (interface{}, error)

当前某一个数据库,执行命令

func (*RedisConnPool) ExpireKey

func (p *RedisConnPool) ExpireKey(key string, seconds int64) (interface{}, error)

func (*RedisConnPool) GetBytes

func (p *RedisConnPool) GetBytes(key string) ([]byte, error)

func (*RedisConnPool) GetFristDel

func (p *RedisConnPool) GetFristDel(key string) (interface{}, error)

func (*RedisConnPool) GetHashMapInt

func (p *RedisConnPool) GetHashMapInt(key string) (map[string]int, error)

func (*RedisConnPool) GetHashMapInt64

func (p *RedisConnPool) GetHashMapInt64(key string) (map[string]int64, error)

func (*RedisConnPool) GetHashMapString

func (p *RedisConnPool) GetHashMapString(key string) (map[string]string, error)

func (*RedisConnPool) GetInt

func (p *RedisConnPool) GetInt(key string) (int, error)

func (*RedisConnPool) GetInt64

func (p *RedisConnPool) GetInt64(key string) (int64, error)

func (*RedisConnPool) GetLastDel

func (p *RedisConnPool) GetLastDel(key string) (interface{}, error)

func (*RedisConnPool) GetListString

func (p *RedisConnPool) GetListString(key string) ([]string, error)

func (*RedisConnPool) GetSETCount

func (p *RedisConnPool) GetSETCount(key string) (int64, error)

func (*RedisConnPool) GetSETRandStringRm

func (p *RedisConnPool) GetSETRandStringRm(key string) (string, error)

func (*RedisConnPool) GetString

func (p *RedisConnPool) GetString(key string) (string, error)

func (*RedisConnPool) Keys

func (p *RedisConnPool) Keys(pattern string) ([]string, error)

func (*RedisConnPool) KeysByteSlices

func (p *RedisConnPool) KeysByteSlices(pattern string) ([][]byte, error)

func (*RedisConnPool) SetAndExpire

func (p *RedisConnPool) SetAndExpire(key string, value interface{}, expire int64) (interface{}, error)

// String(字符串)

func (*RedisConnPool) SetHashMap

func (p *RedisConnPool) SetHashMap(key string, fieldValue map[string]interface{}) (interface{}, error)

// Hash(哈希表)

func (*RedisConnPool) SetList

func (p *RedisConnPool) SetList(key string, list []string) (interface{}, error)

func (*RedisConnPool) SetSETString

func (p *RedisConnPool) SetSETString(key string, value string) (int, error)

func (*RedisConnPool) SetString

func (p *RedisConnPool) SetString(key string, value interface{}) (interface{}, error)

// String(字符串)

func (*RedisConnPool) SetStringList

func (p *RedisConnPool) SetStringList(key string, s string) (interface{}, error)

type USession

type USession struct {
	*sessions.Session
	echo.Context
}

func GetSession

func GetSession(c echo.Context) *USession

func (*USession) AddValue

func (us *USession) AddValue(key, value string) *USession

func (*USession) GetValue

func (us *USession) GetValue(key string) string

func (*USession) Saves

func (us *USession) Saves()

Jump to

Keyboard shortcuts

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