Documentation ¶
Index ¶
- Constants
- Variables
- func CmdCurrentPath() (string, error)
- func CmdExec(command string, timeout int, args ...string) ([]byte, error)
- func CmdExecShell(shell string, timeout int) ([]byte, error)
- func CmdExecShellDefault(shell string) ([]byte, error)
- func Copy(dst interface{}, src interface{}) (err error)
- func CurDatetime() string
- func Date(format string, timestamp ...int64) string
- func DateToTimestamp(dateStr string) int64
- func DiffStrArr(arr1 []string, arr2 []string) []string
- func EscapeShellArg(arg string) string
- func FilePutContent(path string, content string) error
- func FilterStrArr(data []string) []string
- func GenerateUrl(host string, pathString string, urlValueMap map[string]string) (string, error)
- func GetNow() string
- func InArray(obj interface{}, target interface{}) bool
- func JsonStr(v interface{}) string
- func Map2Struct(mapObj interface{}, structObj interface{}) error
- func Md5Str(s string) string
- func ParseTemplate(templateStr string, data interface{}) (string, error)
- func ReplaceTemplateContent(fileContent []byte, configMap map[string]string) (changeContent []byte, err error)
- func SliceInt64ToSliceIntf(s []int64) []interface{}
- func Struct2Map(obj interface{}, toUnderline ...bool) map[string]interface{}
- func Struct2MapFromMapKeyTag(obj interface{}) map[string]string
- func Substr(str string, start, length int) string
- func TarPackage(workspace, pkgPath string, files []string, excludes []string) ([]byte, string, error)
- func TransToCamel(s string) string
- func TransToUnderline(s string) string
- func UniqueStrArr(data []string) []string
- func Utc2LocalDate(d string) (string, error)
Constants ¶
View Source
const ( TIME_FORMAT = "2006-01-02 15:04:05" TIME_FORMAT_YYYYMMDD = "20060102" )
Variables ¶
View Source
var TimeFormatMap = map[string]string{
"Y": "2006",
"m": "01",
"d": "02",
"H": "15",
"i": "04",
"s": "05",
}
Functions ¶
func CmdCurrentPath ¶
func CmdExecShellDefault ¶
func Copy ¶
func Copy(dst interface{}, src interface{}) (err error)
@param dst 要被赋值的结构体,必须是指针 @param src 数据源,必须是一个结构体(非指针)
func CurDatetime ¶
func CurDatetime() string
func EscapeShellArg ¶
EscapeShellArg() adds single quotes around a string and quotes/escapes any existing single quotes allowing you to pass a string directly to a shell function and having it be treated as a single safe argument.
func FilePutContent ¶
write content to file if file not exists, create first. if file exists, use it.
func GenerateUrl ¶
func InArray ¶
func InArray(obj interface{}, target interface{}) bool
* 判断obj是否存在于target中,类似于php的in_array方法
func Map2Struct ¶
func Map2Struct(mapObj interface{}, structObj interface{}) error
mapObj - map 实例 structObj - 结构体实例指针
func ParseTemplate ¶
parse golang template
func ReplaceTemplateContent ¶
func SliceInt64ToSliceIntf ¶
func SliceInt64ToSliceIntf(s []int64) []interface{}
func Struct2Map ¶
结构体转为 map obj 必须是结构体实例,不可以是指针 toUnderLine, 是否需要将驼峰转为 下划线
func Struct2MapFromMapKeyTag ¶
for example :
type A struct { str string `mapKey: "MAP_STRING"` } a := &A{ str: "val" } m := Struct2MapFromMapKeyTag(a) m["MAP_STRING"] == "val"
func TarPackage ¶
func TarPackage(workspace, pkgPath string, files []string, excludes []string) ([]byte, string, error)
pack version package
func TransToUnderline ¶
snake string, XxYy to xx_yy , XxYY to xx_yy
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.