Versions in this module Expand all Collapse all v0 v0.0.3 Feb 4, 2021 v0.0.2 Feb 3, 2021 Changes in this version + const BYTE + const ContentTypeForm + const ContentTypeJson + const ContentTypeXml + const FieldsKey + const GIGABYTE + const KILOBYTE + const MEGABYTE + const TERABYTE + const TagsKey + const Verb_DELETE + const Verb_GET + const Verb_HEAD + const Verb_POST + const Verb_PUT + var ErrKeyNotFound = errors.New("key not found") + func AddTags(ms MapStr, tags []string) error + func AutoGetAddress(addr string) string + func ByteSize(bytes uint64) string + func BytesSearchValue(data, startTerm, endTerm, searchTrim []byte) bool + func BytesToInt64(buf []byte) int64 + func BytesToString(bs []byte) string + func BytesToUint32(b []byte) (v uint32) + func BytesToUint64(b []byte) (v uint64) + func CheckIPBinding(ip string) (bool, error) + func CheckInstanceLock(p string) + func CheckProcessExists(pid int) bool + func ClearInstanceLock() + func ContainStr(s, substr string) bool + func ContainsAnyInArray(s string, v []string) bool + func Copy(sourceStruct interface{}, pointToTarget interface{}) (err error) + func CopyFile(src, dst string) (w int64, err error) + func CreateCert(template, parent *x509.Certificate, pub interface{}, parentPriv interface{}) (cert *x509.Certificate, certPEM []byte, err error) + func CreateFile(dir string, name string) (string, error) + func DeepCopy(value interface{}) interface + func EncodeToBytes(key interface{}) ([]byte, error) + func Expand(value map[string]interface{}) map[string]interface + func ExpandPrefixed(value map[string]interface{}, prefix string) map[string]interface + func ExpandPrefixedToResult(value map[string]interface{}, prefix string, result map[string]interface{}) + func ExtractFieldFromJson(data *[]byte, fieldStartWith []byte, fieldEndWith []byte, ...) (bool, []byte) + func ExtractFieldFromJsonOrder(data *[]byte, fieldStartWith []byte, fieldEndWith []byte, ...) (bool, []byte) + func FileAppendContentWithByte(file string, content []byte) (int, error) + func FileAppendNewLine(file string, content string) (int, error) + func FileAppendNewLineWithByte(file string, content []byte) (int, error) + func FileDelete(file string) error + func FileExists(path string) bool + func FileExtension(file string) string + func FileGetContent(file string) ([]byte, error) + func FileMTime(file string) (int64, error) + func FilePutContent(file string, content string) (int, error) + func FilePutContentWithByte(file string, content []byte) (int, error) + func FileSize(file string) (int64, error) + func FilesExists(path ...string) bool + func FilterDirName(name string) bool + func FilterSpecialChar(keyword string) string + func Flatten(value interface{}, ignoreNil bool) map[string]interface + func FlattenJSON(value interface{}, ignoreNil bool) (m map[string]interface{}) + func FlattenJSONString(nestedstr, prefix string, ignoreNil bool) (string, error) + func FlattenPrefixed(value interface{}, prefix string, ignoreNil bool) map[string]interface + func FlattenPrefixedToResult(value interface{}, prefix string, m map[string]interface{}, ignoreNil bool) + func FlattenPrefixedToResultWithTagAsFieldName(value interface{}, prefix string, m map[string]interface{}, tag string, ...) + func FormatTime(date time.Time) string + func FormatTimeForFileName(date time.Time) string + func FormatTimeWithLocalTZ(date time.Time) string + func FormatTimeWithTZ(date time.Time) string + func FormatUnixTimestamp(unix int64) string + func FromJSONBytes(b []byte, v interface{}) + func FromJson(str string, to interface{}) error + func FromUnixTimestamp(unix int64) time.Time + func GenRsaKey() (prvkey, pubkey []byte) + func GetAddress(adr string) *net.TCPAddr + func GetAvailablePort(ip string, port int) int + func GetBytes(key interface{}) []byte + func GetCertTemplate() (*x509.Certificate, error) + func GetClientCert(rootCert *x509.Certificate, rootKey *rsa.PrivateKey) (clientTLSCert tls.Certificate, clientCertPEM, clientKeyPEM []byte) + func GetFieldValueByTagName(any interface{}, tagName string, tagValue string) string + func GetHost(url string) string + func GetIncrementID(bucket string) int64 + func GetIntValue(any interface{}) int + func GetIntranetIP() (string, error) + func GetLocalIPs() []string + func GetLocalZone() string + func GetRootCert() (rootCert *x509.Certificate, rootKey *rsa.PrivateKey, rootCertPEM []byte) + func GetRootUrl(source *uri.URL) string + func GetRuntimeErrorMessage(r runtime.Error) string + func GetSafetyInternalAddress(addr string) string + func GetSplitFunc(split []byte) func(data []byte, atEOF bool) (advance int, token []byte, err error) + func GetTypeName(any interface{}, lowercase bool) string + func GetUUID() string + func GetValidAddress(addr string) string + func Int64ToBytes(i int64) []byte + func IntToString(num int) string + func Invoke(any interface{}, name string, args ...interface{}) + func IsBytesEndingWith(data *[]byte, ending []byte) bool + func IsBytesEndingWithOrder(data *[]byte, ending []byte, reverse bool) bool + func IsExist(path string) bool + func IsFile(file string) bool + func IsPublicIP(IP net.IP) bool + func IsValidTLD(tld string) bool + func JoinPath(filenames ...string) string + func MD5digest(str string) string + func MD5digestBytes(b []byte) [16]byte + func MD5digestString(b []byte) string + func MergeFields(ms, fields MapStr, underRoot bool) error + func MergeSpace(in string) (out string) + func NoWordBreak(in string) string + func PickRandomName() string + func Post(url string, values url.Values) []byte + func PrefixStr(s, substr string) bool + func ProcessJsonData(data *[]byte, fieldStartWith []byte, fieldEndWith []byte, ...) bool + func RemoveSpaces(str string) string + func Rename(file string, to string) error + func ReplaceByte(str []byte, old, new []byte) []byte + func RequireSudo() bool + func RestorePersistID(path string) + func RsaDecrypt(ciphertext, keyBytes []byte) []byte + func RsaEncrypt(data, keyBytes []byte) []byte + func RsaSignWithSha256(data []byte, keyBytes []byte) []byte + func RsaVerySignWithSha256(data, signData, keyBytes []byte) bool + func Sha1Hash(str string) string + func SnapshotPersistID() + func StringToUTF16(s string) []uint16 + func SubString(str string, begin, length int) (substr string) + func SubStringWithSuffix(str string, length int, suffix string) string + func SuffixStr(s, substr string) bool + func TestListenPort(ip string, port int) bool + func TestPort(port int) bool + func ToBytes(s string) (uint64, error) + func ToInt(str string) (int, error) + func ToJSONBytes(v interface{}) []byte + func ToJson(in interface{}, indent bool) string + func ToLowercase(str []byte) []byte + func ToMegabytes(s string) (uint64, error) + func ToUppercase(str []byte) []byte + func TrimLeftStr(str string, left string) string + func TrimSpaces(str string) string + func TypeIsMap(any interface{}) bool + func Uint32toBytes(b []byte, v uint32) + func Uint64toBytes(b []byte, v uint64) + func UnicodeIndex(str, substr string) int + func UrlDecode(str string) string + func UrlEncode(str string) string + func WaitServerUp(addr string, duration time.Duration) error + func XSSHandle(src string) string + type Annotation struct + Annotation []Annotation + Field string + Tag string + Type string + func GetTagsByTagName(any interface{}, tagName string) []Annotation + type EventMetadata struct + Fields MapStr + FieldsUnderRoot bool + Tags []string + type MapStr map[string]interface + func (m MapStr) Clone() MapStr + func (m MapStr) CopyFieldsTo(to MapStr, key string) error + func (m MapStr) Delete(key string) error + func (m MapStr) GetValue(key string) (interface{}, error) + func (m MapStr) HasKey(key string) (bool, error) + func (m MapStr) Put(key string, value interface{}) (interface{}, error) + func (m MapStr) String() string + func (m MapStr) StringToPrint() string + func (m MapStr) Update(d MapStr) + func MapStrUnion(dict1 MapStr, dict2 MapStr) MapStr + type Request struct + Agent string + Body []byte + ContentType string + Cookie string + Method string + Proxy string + Url string + func NewDeleteRequest(url string, body []byte) *Request + func NewGetRequest(url string, body []byte) *Request + func NewPostRequest(url string, body []byte) *Request + func NewPutRequest(url string, body []byte) *Request + func NewRequest(method, url string) *Request + func (r *Request) AcceptGzip() *Request + func (r *Request) AddHeader(key, v string) *Request + func (r *Request) SetAgent(agent string) *Request + func (r *Request) SetBasicAuth(username, password string) *Request + func (r *Request) SetContentType(contentType string) *Request + func (r *Request) SetProxy(proxy string) *Request + type Result struct + Body []byte + Headers map[string][]string + Host string + Size uint64 + StatusCode int + Url string + func ExecuteRequest(req *Request) (result *Result, err error) + func HttpDelete(resource string) (*Result, error) + func HttpGet(resource string) (*Result, error) + func HttpGetWithCookie(resource string, cookie string, proxy string) (*Result, error) + type StringSet map[string]struct + func MakeStringSet(strings ...string) StringSet + func (set StringSet) Add(s string) + func (set StringSet) Count() int + func (set StringSet) Del(s string) + func (set StringSet) Has(s string) (exists bool)