golang.ext

command module
v0.0.0-...-da8c12f Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2018 License: MIT Imports: 4 Imported by: 0

README

Golang 包扩展

base 包

  • Struct => Map
  • Map => Struct
  • 判断字符串是否为空

color 包

cmd 包
  • Black 前景色
  • Red 前景色
  • Green 前景色
  • Yellow 前景色
  • Blue 前景色
  • Magenta 前景色
  • Cyan 前景色
  • White 前景色
  • Gray 前景色
  • Black 背景色
  • Red 背景色
  • Green 背景色
  • Yellow 背景色
  • Blue 背景色
  • Magenta 背景色
  • Cyan 背景色
  • White 背景色
  • Gray 背景色

file 包

  • 判断路径是否存在(文件|文件夹)
  • 创建目录(多级创建)

path 包

  • 获取文件路径的相对路径 (相对GOPATH)
  • 获取以当前执行目录为相对参照的文件的绝对路径

log 包

  • FATAL 输出
  • ERROR 输出
  • WARN 输出
  • INFO 输出
  • DEBUG 输出
  • 初始化 log 文件存储
  • Open 开启日志记录
  • Close 关闭日志记录
  • SetFlags 设置记录项标识
  • SetFile 设置记录文件
  • SetLevel 设置日志级别

日志级别

  • OFF 不记录任何
  • FATAL 记录致命错误
  • ERROR 记录普通错误及以上
  • WARN 记录警告及以上
  • INFO 记录普通输出及以上
  • DEBUG 记录调试输出及以上
  • ALL 记录所有日志

日志标识

  • Ltime 时间标识
  • Ldate 日期标识
  • Lmicroseconds 微秒标识
  • Llongfile 长文件名标识
  • Lshortfile 短文件名标识
  • LUTC UTC时间标识

safe 包

safemap 包
  • New 返回 SafeMap
  • Get 获取 Map 的值
  • Set 设置 Map 的值
  • Check 校验 Map 的值
  • Delete 删除 Map 的值
safefile 包
  • 安全读
  • 安全写
  • 安全复制
  • 安全删除

unsafe 包

  • string => int
  • string => int8
  • string => int16
  • string => int32
  • string => int64
  • string => uint8
  • string => uint16
  • string => uint32
  • string => uint64
  • string => float64
  • string => float32
  • string => bool

time 包

  • time.Time => string
  • 时间戳 => string
  • string => (UTC)time.Time (不安全)
  • string => (本地)time.Time (不安全)
  • string => (UTC)时间戳 (不安全)
  • string => (本地)时间戳 (不安全)

wrong 包

  • Println 错误按行打印
  • Panicln 错误恐慌打印 (panic)
  • Fatalln 错误致命打印 (fatal)

crypto 包

  • MD5 加密
  • RSA 加密
  • AES 加密
注意
  • 所谓不安全即不考虑 error

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
color
log
math
map

Jump to

Keyboard shortcuts

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