Documentation ¶
Index ¶
- Constants
- Variables
- func AESDecrypt(baseStr string) string
- func AESDecrypt2(cipherkey, ciphertext []byte) ([]byte, error)
- func AESEncrypt(originPWD []byte) string
- func AESEncrypt2(cipherkey, src []byte) []byte
- func Check(a interface{})
- func CheckPWD(password, enPassword string) bool
- func Config(conf interface{})
- func ConfigFromFile(filePath string, conf interface{})
- func ConfigFromSlice(filePaths []string, conf interface{})
- func DecimalToJsonNumber(dd decimal.Decimal, precision int32) ejson.Number
- func FileMonitoring(filePth string, hookfn func([]byte))
- func GetActiveIps() (ips []string, err error)
- func GetCurrentPath(inDir string) string
- func GetFilesByDir(prefixPath string) (fileInfos []os.FileInfo, err error)
- func GetFilesByDirFileRegex1(prefixDir string, regex string) (fileInfos []os.FileInfo, err error)
- func GetLocalIps() (ips []string, err error)
- func JSONMarshalToString(v interface{}) string
- func MapToStruct(inMap map[string]interface{}, out interface{}) error
- func Md5(b []byte) string
- func PathExists(path string) (bool, error)
- func ProgramName() string
- func ReadAll(filePth string) ([]byte, error)
- func ReadBlock(filePth string, bufSize int, hookfn func([]byte)) error
- func ReadContentByFileName(fileFullName string) (fileContent []string, err error)
- func ReadLine(filePth string, hookfn func([]byte)) error
- func StructToMap(in interface{}) (map[string]interface{}, error)
Constants ¶
const ( // 时间格式化字符串 SysTimeform string = "2006-01-02 15:04:05" SysTimeformShort string = "2006-01-02" )
前面是含义,后面是 go 的表示值,多种表示,逗号","分割 年 06,2006 月份 1,01,Jan,January 日 2,02,_2 时 3,03,15,PM,pm,AM,am 分 4,04 秒 5,05 周几 Mon,Monday 时区时差表示 -07,-0700,Z0700,Z07:00,-07:00,MST 时区字母缩写 MST 您看出规律了么!哦是的,你发现了,这里面没有一个是重复的,所有的值表示都唯一对应一个时间部分。 并且涵盖了很多格式组合。
Variables ¶
var ( JSONMarshal = json.Marshal JSONUnmarshal = json.Unmarshal JSONMarshalIndent = json.MarshalIndent JSONNewDecoder = json.NewDecoder JSONNewEncoder = json.NewEncoder )
定义JSON操作
var SysTimeLocation, _ = time.LoadLocation("Asia/Chongqing")
中国时区
Functions ¶
func AESDecrypt ¶
----------------------------------------------------------- ----------------------- 解密 ------------------------------ ----------------------------------------------------------- 先base64转码,再解密
func AESDecrypt2 ¶
AESDecrypt decrypts a piece of data. The cipherkey argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.
func AESEncrypt ¶
----------------------------------------------------------- ----------------------- 加密 ------------------------------ ----------------------------------------------------------- 加密后再base64编码成string
func AESEncrypt2 ¶
AESEncrypt encrypts a piece of data. The cipherkey argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.
func Check ¶
func Check(a interface{})
结构体指针检查验证,如果传入的interface为nil,就通过log.Panic函数抛出一个异常 被用在starter中检查公共资源是否被实例化了
func ConfigFromFile ¶
func ConfigFromFile(filePath string, conf interface{})
func ConfigFromSlice ¶
func ConfigFromSlice(filePaths []string, conf interface{})
func DecimalToJsonNumber ¶
func GetActiveIps ¶
func GetFilesByDir ¶
根据目录获取文件或文件夹信息,不递归获取
func GetFilesByDirFileRegex1 ¶
func GetLocalIps ¶
func JSONMarshalToString ¶
func JSONMarshalToString(v interface{}) string
JSONMarshalToString JSON编码为字符串
func MapToStruct ¶
func ProgramName ¶ added in v0.0.7
func ProgramName() string
func ReadContentByFileName ¶
func StructToMap ¶
Types ¶
This section is empty.