Documentation ¶
Index ¶
- Constants
- Variables
- func AesDecode(src []byte) ([]byte, error)
- func AesDecrypt(crypted, key []byte) ([]byte, error)
- func AesEncode(src []byte) ([]byte, error)
- func AesEncrypt(origData, key []byte) ([]byte, error)
- func Array2String(array []string) string
- func ArrayInt2String(array []int64) string
- func Base64Decode(src string) ([]byte, error)
- func Base64Encode(src []byte) string
- func ClearDir(dir string) bool
- func Date(t time.Time, format string) string
- func DateFormat(t time.Time, layout string) (datestring string)
- func DateLocal() time.Time
- func DateParse(dateString, format string) (time.Time, error)
- func DateTime2String(dt time.Time) string
- func DirExists(path string) bool
- func ExecSystem(s string)
- func FileSize(size int) string
- func GBKToUtf8(str string) string
- func GetAppRoot() string
- func GetDateAsDirName() string
- func GetDateYYYYMMDD() string
- func GetDir(path string) error
- func GetEnv(key string, def ...string) string
- func GetExecFuncId(key ...interface{}) (Id string)
- func GetFilename(path string) string
- func GetFilesize(path string) int64
- func Html2str(html string) string
- func Int2str(i int) string
- func IpInt2String(ipint int64) string
- func IpString2Int64(ipstr string) int64
- func IsDir(path string) bool
- func IsEmail(email string) bool
- func IsFile(path string) bool
- func IsMap_String_String(obj interface{}) bool
- func IsUsername(username string) bool
- func ListContains(list []interface{}, key interface{}) (finded bool)
- func ListDir(dir string) []string
- func LoadJsonFile(filePath string) (map[string]interface{}, error)
- func MD5(s string) string
- func MD5Ex(s string) string
- func MD5byte(s string) []byte
- func MakeDirAll(path string, perm os.FileMode) error
- func MapIntKeys(data map[int]int) []int
- func MapKeys(data map[string]interface{}) []string
- func MapToStruct(m map[string]interface{}, s interface{})
- func Merge(dst, src map[string]interface{}) map[string]interface{}
- func NewGuid() string
- func NewGuidWith(str string) string
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func Print(ob interface{})
- func RandomInt(min int, max int) int
- func RandomInt64(min int, max int) int64
- func RandomPwd(num int) string
- func RandomString(num int) string
- func RemoveDuplicatesAndEmpty(a []string) (ret []string)
- func RemoveFormatting(html string) string
- func SHA1(s string) string
- func SHA1Byte(s string) []byte
- func SendMail(subject string, message string, from string, to []string, ...) error
- func SnakeCasedName(name string) string
- func SplitFilename(filename string) (baseName, ext string)
- func Sprint(ob interface{}) string
- func Str2int(s string) (int, error)
- func Str2int64(s string) (int64, error)
- func StringEqual(a, b []string) bool
- func StringsContains(list []string, key string) (finded bool)
- func StripTags(html string) string
- func StructName(s interface{}) string
- func StructToMap(s interface{}) map[string]interface{}
- func StructToSnakeKeyMap(s interface{}) map[string]interface{}
- func Substr(str string, start, length int) string
- func Substring(str string, start int) string
- func SubstringByte(str string, start int) string
- func TarGz(srcDirPath string, destFilePath string) error
- func TarGzFiles(src []string, destFilePath string) error
- func TheTime(counts time.Duration) time.Time
- func TheTimeString(counts time.Duration) string
- func TheYearMonthString() (yms string, ymi int)
- func TimeLocal() time.Time
- func TimeLocalMDHString() string
- func TimeLocalString() string
- func TimeLocalYYYYMMDDHHMMSSString() string
- func TimeParseOften(value string) (time.Time, error)
- func Timestamp2String(timestamp int64) string
- func TransferExt(path string, toExt string) string
- func UnTarGz(srcFilePath string, destDirPath string) error
- func UrlEncode(s string) string
- func Utf8ToGBK(str string) string
- func ZeroPadding(ciphertext []byte, blockSize int) []byte
- func ZeroUnPadding(origData []byte) []byte
- type Node
- type SmtpConfig
Constants ¶
const TIME_LAYOUT_OFTEN = "2006-01-02 15:04:05"
Variables ¶
var (
MaxDepth = 32
)
Functions ¶
func AesDecrypt ¶
func AesEncrypt ¶
func ExecSystem ¶
func ExecSystem(s string)
func GetFilename ¶
func LoadJsonFile ¶
load json file to a map
func MapToStruct ¶
func MapToStruct(m map[string]interface{}, s interface{})
map & struct convert is from https://github.com/sdegutis/go.mapstruct convert map to struct
func Merge ¶
Merge recursively merges the src and dst maps. Key conflicts are resolved by preferring src, or recursively descending, if both src and dst are maps.
func PKCS5Padding ¶
func PKCS5UnPadding ¶
func RemoveFormatting ¶
Simplify HTML text by removing tags
func SendMail ¶
func SendMail(subject string, message string, from string, to []string, smtpConfig SmtpConfig, isHtml bool) error
send mail
func SnakeCasedName ¶
convert like this: "HelloWorld" to "hello_world"
func StringEqual ¶
func StructToSnakeKeyMap ¶
func StructToSnakeKeyMap(s interface{}) map[string]interface{}
convert struct to map but struct's field name to snake cased map key
func TarGz ¶
Gzip and tar from source directory or file to destination file you need check file exist before you call this function
func TarGzFiles ¶
main functions shows how to TarGz a directory/file and UnTarGz a file func main() { targetFilePath := "testdata.tar.gz" srcDirPath := "testdata" TarGz(srcDirPath, targetFilePath) UnTarGz(targetFilePath, srcDirPath+"_temp") }
func TheYearMonthString ¶
返回当前月份,yms str类型,ymi int 类型
func TimeParseOften ¶
解析常用的日期时间格式:2014-01-11 16:18:00,东八区
func Timestamp2String ¶
将unix 时间戳转换为时间字符串 1441070992=>2015-09-01 09:29:52
func UnTarGz ¶
Ungzip and untar from source file to destination directory you need check file exist before you call this function