Documentation ¶
Index ¶
- Constants
- func ArrayChunk[T comparable](array []T, size int) [][]T
- func ArrayCombine[K, V comparable](keys []K, values []V) map[K]V
- func ArrayCountValues[T comparable](array []T) map[T]int
- func ArrayDiff(arrays ...interface{}) []interface{}
- func ArrayFilter(array interface{}, callback interface{}) []interface{}
- func ArrayIntersect(arrays ...interface{}) []interface{}
- func ArrayMap(array interface{}, callback interface{}) []interface{}
- func ArrayMax[T constraints.IntFloat](a []T) T
- func ArrayMin[T constraints.IntFloat](a []T) T
- func ArrayReverse[V comparable](s []V)
- func ArraySum[T constraints.IntFloat](array []T) (T, error)
- func ArrayUdiff(uf func(interface{}, interface{}) int, arrays ...interface{}) []interface{}
- func ArrayUnique[T comparable](a []T) []T
- func ArrayValues[K, V comparable](a map[K]V) []V
- func ConcatFast(s ...string) string
- func Date(args ...interface{}) string
- func EqualSlices[T comparable](a, b []T) bool
- func FileExists(fileName string) bool
- func FileGetContents(path string, args ...interface{}) (string, error)
- func FilePutContents(fileName, data string, flags ...interface{}) (int, error)
- func GetMxrr(domain string) (isMx bool, mxs []*net.MX, err error)
- func HTTPBuildQuery(pairs map[string]interface{}) string
- func HashFile(algo, fileName string) (string, error)
- func HashHmac(message, secret string, hashAlgo func() hash.Hash) string
- func IP2long(ipAddr string) (uint32, error)
- func InArray[T comparable](needle T, haystack []T) bool
- func IsDir(fileName string) bool
- func IsFile(fileName string) bool
- func IsLink(fileName string) bool
- func IsValidMac(message, messageMAC, key string, hashAlgo func() hash.Hash) bool
- func Long2ip(ipLong uint32) string
- func Md5(s string) string
- func Rand(min, max int64) int64
- func Range(min, max int, step ...int) []int
- func Serialize(val interface{}) (string, error)
- func Sha1(s string) string
- func Sha2(s string) string
- func StrIReplace(args ...interface{}) (string, error)
- func StrReplace(args ...interface{}) (string, error)
- func UnixMicro() int64
- func UnixMilli() int64
- func Unserialize(val string, v interface{}) error
- type Context
- type Item
- type PriorityQueue
- func (pq *PriorityQueue) Init()
- func (pq PriorityQueue) Len() int
- func (pq PriorityQueue) Less(i, j int) bool
- func (pq *PriorityQueue) Pop() interface{}
- func (pq *PriorityQueue) Push(x interface{})
- func (pq PriorityQueue) Swap(i, j int)
- func (pq *PriorityQueue) Update(item *Item, value string, priority int)
- type Time
Constants ¶
const ( DivideMicroseconds = 1e3 DivideMilliseconds = 1e6 )
const (
FileAppend = os.O_APPEND
)
FileAppend const mapping php -> go
Variables ¶
This section is empty.
Functions ¶
func ArrayChunk ¶
func ArrayChunk[T comparable](array []T, size int) [][]T
ArrayChunk split an array into chunks
func ArrayCombine ¶
func ArrayCombine[K, V comparable](keys []K, values []V) map[K]V
ArrayCombine creates an array by using one array for keys and another for its values returns map[key]value if both slices are equal and nil otherwise
func ArrayCountValues ¶
func ArrayCountValues[T comparable](array []T) map[T]int
ArrayCountValues counts all the values of an array/slice
func ArrayDiff ¶
func ArrayDiff(arrays ...interface{}) []interface{}
ArrayDiff compares array1 against one or more other arrays returns the values in array1 that are not present in any of the other arrays
func ArrayFilter ¶
func ArrayFilter(array interface{}, callback interface{}) []interface{}
ArrayFilter filters elements of an array using a callback function
func ArrayIntersect ¶
func ArrayIntersect(arrays ...interface{}) []interface{}
ArrayIntersect computes the intersection of arrays
func ArrayMap ¶
func ArrayMap(array interface{}, callback interface{}) []interface{}
ArrayMap applies the callback to the elements of the given arrays
func ArrayMax ¶ added in v1.0.1
func ArrayMax[T constraints.IntFloat](a []T) T
ArrayMax finds maximum value from []T
func ArrayMin ¶ added in v1.0.1
func ArrayMin[T constraints.IntFloat](a []T) T
ArrayMin finds minimum value from []T
func ArrayReverse ¶ added in v1.0.4
func ArrayReverse[V comparable](s []V)
ArrayReverse reverse slice passed as an argument
func ArraySum ¶
func ArraySum[T constraints.IntFloat](array []T) (T, error)
ArraySum calculate the sum of values in an array
func ArrayUdiff ¶ added in v0.8.2
func ArrayUdiff(uf func(interface{}, interface{}) int, arrays ...interface{}) []interface{}
ArrayUdiff computes the difference of arrays by using a callback function for data comparison
func ArrayUnique ¶ added in v1.0.2
func ArrayUnique[T comparable](a []T) []T
ArrayUnique returns unique values form []T
func ArrayValues ¶ added in v1.0.3
func ArrayValues[K, V comparable](a map[K]V) []V
ArrayValues Return all the values of map as a slice of values with corresponding type
func ConcatFast ¶ added in v1.0.5
ConcatFast concatenates strings faster than strings.Builder (see benchmarks)
func Date ¶
func Date(args ...interface{}) string
Date returns formatted output of system data/time 1st argument formatted string e.g.: Y-m-d H:i:s 2nd argument int64 unix timestamp
func EqualSlices ¶ added in v0.8.4
func EqualSlices[T comparable](a, b []T) bool
EqualSlices compares two slices and returns true if they are equal, false otherwise in case of passing wrong (non-slice) arguments error will be returned
func FileExists ¶
FileExists checks wether file or catalog exists or not returning true or false respectfully
func FileGetContents ¶
FileGetContents reads files, http requests streams path name of a file or domain from where to read data flags[0] - offset flags[1] - maxLen
func FilePutContents ¶
FilePutContents write files with offset/limit fileName name of file to where put data flags[0] - flags how to put this data FileAppend | LockEx
func GetMxrr ¶
GetMxrr Get MX records corresponding to a given Internet host name Returns TRUE if any records are found; returns FALSE if no records were found or if an error occurred
func HTTPBuildQuery ¶
HTTPBuildQuery Generates a URL-encoded query string from the associative map
func HashFile ¶
HashFile hashs file fileName by calculating hash md5/sha1/sha2 based on it's content
func IP2long ¶
IP2long converts a string containing an (IPv4) Internet Protocol dotted address into a long integer
func InArray ¶
func InArray[T comparable](needle T, haystack []T) bool
InArray checks if a value exists in an array
func IsValidMac ¶ added in v0.8.2
IsValidMac validates HMAC based hash returning true if it is valid or false otherwise
func Long2ip ¶
Long2ip converts an long integer address into a string in (IPv4) Internet standard dotted format
func Rand ¶
Rand returns a pseudo-random integer between min and max based on unix-nano time seed !! for random numbers suitable for security-sensitive work, use the crypto/rand package instead
func Range ¶
Range creates int slice of min to max range If a step value is given, it will be used as the increment between elements in the sequence. step should be given as a positive number. If not specified, step will default to 1.
func StrIReplace ¶
StrIReplace replaces all occurrences of the search case-insensitive string|slice with the replacement string If search and replace are arrays, then str_replace() takes a value from each array and uses them to search and replace on subject.
func StrReplace ¶
StrReplace replaces all occurrences of the search string|slice with the replacement string If search and replace are arrays, then str_replace() takes a value from each array and uses them to search and replace on subject.
func Unserialize ¶
Unserialize decodes string back into Go code representation
Types ¶
type Context ¶
type Context struct { Headers map[string]string RequestMethod string Req *http.Request UploadMaxFileSize int64 }
Context is the opts for http/net requests
func NewContext ¶
func NewContext() *Context
NewContext returns a new Context with preset default headers and request method
func (*Context) MoveUploadedFile ¶
MoveUploadedFile uploads file from fieldName to destination path
type Item ¶
type Item struct { Value string // The Value of the item; arbitrary. Priority int // The Priority of the item in the queue. // The Index is needed by update and is maintained by the heap.Interface methods. Index int // The Index of the item in the heap. }
An Item is something we manage in a Priority queue.
type PriorityQueue ¶
type PriorityQueue []*Item
A PriorityQueue implements heap.Interface and holds Items.
func (*PriorityQueue) Init ¶
func (pq *PriorityQueue) Init()
func (PriorityQueue) Len ¶
func (pq PriorityQueue) Len() int
func (PriorityQueue) Less ¶
func (pq PriorityQueue) Less(i, j int) bool
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() interface{}
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(x interface{})
func (PriorityQueue) Swap ¶
func (pq PriorityQueue) Swap(i, j int)