XGlobal

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2020 License: MIT Imports: 6 Imported by: 0

README

Global 全局配置信息及工具函数

一些工具函数

// 幂运算
func Powerf(x float64, n int) float64 {}

// 生成固定位随机数字
func RandomNumber(l int) (string, error) {}

// 生成固定长度随机字符串
func RandomString(l int) string {}

// 用户密码加盐生成哈希
func HashPassword(src string) (hashStr, salt string) {}

// 校验密码
func ValidatePassword(passStr, salt, passHash string) bool {}


// TODO  

Documentation

Index

Constants

View Source
const (
	Env      = "Env"      // 允许环境:dev、testing、product
	Host     = "Host"     // 主机地址
	Endpoint = "Endpoint" // 节点
	AppName  = "AppName"  // 应用名
	Version  = "Version"  // 应用版本
)

全局配置

Variables

This section is empty.

Functions

func GetAppName

func GetAppName() string

func GetEndpoint

func GetEndpoint() string

func GetEnv

func GetEnv() string

func GetHost

func GetHost() string

func GetVersion

func GetVersion() string

func HashPassword

func HashPassword(src string) (hashStr, salt string)

用户密码加盐生成哈希

func NewStarter

func NewStarter() *starter

func Powerf

func Powerf(x float64, n int) float64

幂运算

func RandomNumber

func RandomNumber(l int) (string, error)

生成固定位随机数字

func RandomString

func RandomString(l int) string

生成固定长度随机字符串

func ValidatePassword

func ValidatePassword(passStr, salt, passHash string) bool

校验密码

Types

type Global

type Global map[string]interface{}

func G

func G() Global

Usage: env := XGlobal.G().Get("your global config key")

func (Global) Get

func (g Global) Get(k string) interface{}

func (Global) Set

func (g Global) Set(k string, v interface{})

Jump to

Keyboard shortcuts

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