Documentation ¶
Index ¶
- Constants
- Variables
- func BytesToString(b []byte) string
- func EnsureFileExists(path string)
- func EnsureFolderExists(folder string)
- func Exists(path string) bool
- func ExtraTarFile(r io.Reader)
- func FormCode(code uint) string
- func FromEnv(env Env) string
- func GetEnvList() (envList []string)
- func GetMd5Sum(f io.Reader) string
- func GetNowLong() string
- func GetTimeRFC(timestamp int64) string
- func GetYearMonthDay() string
- func IOWriteFile(r io.Reader, filePath string) error
- func Intersection(slice1 []string, slice2 []string) []string
- func IsLiveEnv(sEnv string) bool
- func LastString(ss []string) string
- func LastStringWithSplit(str, delimiter string) string
- func RandString(n int) string
- func ReadFile(path string) ([]byte, error)
- func Reverse(slice []string)
- func StringToBytes(s string) (b []byte)
- func StringsRemove(slice []string, str string) []string
- func StringsToInts(slice []string) (ints []int, err error)
- func TemplateGenerateFileFromReader(reader io.Reader, dstPath string, data interface{}) error
- func TemplateGenerateString(str string, data interface{}) (string, error)
- func ToCode(sCode string) uint
- func ToSet(items []string) (ret []string)
- func TrimStrings(slice []string, cutSet ...string) (ns []string)
- func UnixTimeMilliSecond() float64
- func WriteFile(path string, content string) error
- func WriteTarReaderToFile(filename string, tarReader *tar.Reader)
- type Env
Constants ¶
View Source
const ( AirdbSuccess uint = 20000 AirdbFailed uint = 20001 AirdbAuthFailed uint = 20002 AirdbUndefined uint = 24999 AirdbUnknown uint = 25000 )
Airdb error codes for user.
View Source
const ( FilePerm600 os.FileMode = 0o600 // For secret files. FilePerm644 os.FileMode = 0o644 // For normal files. FilePerm755 os.FileMode = 0o755 // For directory or execute files. )
View Source
const ( TimeFormatLong = "20060102150405" TimeFormatDay = "2006-01-02" )
Variables ¶
View Source
var CodeMap = map[uint]string{ AirdbSuccess: "Success", AirdbFailed: "Failed", AirdbAuthFailed: "Auth failed", AirdbUndefined: "Undefined", AirdbUnknown: "Uknown error", }
Functions ¶
func BytesToString ¶
b2s converts byte slice to a string without memory allocation. See https://groups.google.com/forum/#!msg/Golang-Nuts/ENgbUzYvCuU/90yGx7GUAgAJ .
Note it may break if string and/or slice header will change in the future go versions.
func EnsureFileExists ¶
func EnsureFileExists(path string)
func EnsureFolderExists ¶
func EnsureFolderExists(folder string)
func ExtraTarFile ¶
func GetEnvList ¶
func GetEnvList() (envList []string)
func GetNowLong ¶
func GetNowLong() string
func GetTimeRFC ¶
func GetYearMonthDay ¶
func GetYearMonthDay() string
func Intersection ¶
func LastString ¶
func LastStringWithSplit ¶
func RandString ¶
func Reverse ¶
func Reverse(slice []string)
Reverse string slice [site user info 0] -> [0 info user site].
func StringToBytes ¶
s2b converts string to a byte slice without memory allocation.
Note it may break if string and/or slice header will change in the future go versions.
func StringsRemove ¶
StringsRemove an value form an string slice.
func StringsToInts ¶
StringsToInts string slice to int slice.
func TemplateGenerateString ¶
func TrimStrings ¶
TrimStrings trim string slice item.
func UnixTimeMilliSecond ¶
func UnixTimeMilliSecond() float64
func WriteTarReaderToFile ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.