pgo: github.com/arthurkushman/pgo Index | Files | Directories

package pgo

import "github.com/arthurkushman/pgo"

Index

Package Files

array.go collection.go core.go crypto.go date.go files.go math.go net.go request.go str.go

Constants

const (
    DivideMicroseconds = 1e3
    DivideMilliseconds = 1e6
)
const (
    FileAppend = os.O_APPEND
)

const mapping php -> go

func ArrayChunk Uses

func ArrayChunk(array interface{}, size int) []interface{}

ArrayChunk split an array into chunks

func ArrayCombine Uses

func ArrayCombine(keys interface{}, values interface{}) map[interface{}]interface{}

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 Uses

func ArrayCountValues(array interface{}) map[interface{}]int

ArrayCountValues counts all the values of an array/slice

func ArrayDiff Uses

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 Uses

func ArrayFilter(array interface{}, callback interface{}) []interface{}

ArrayFilter filters elements of an array using a callback function

func ArrayIntersect Uses

func ArrayIntersect(arrays ...interface{}) []interface{}

ArrayIntersect computes the intersection of arrays

func ArrayMap Uses

func ArrayMap(array interface{}, callback interface{}) []interface{}

ArrayMap applies the callback to the elements of the given arrays

func ArraySum Uses

func ArraySum(array interface{}) (float64, error)

ArraySum calculate the sum of values in an array

func Date Uses

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 FileExists Uses

func FileExists(fileName string) bool

FileExists checks wether file or catalog exists or not returning true or false respectfully

func FileGetContents Uses

func FileGetContents(path string, args ...interface{}) (string, error)

FileGetContents reads files, http requests streams fileName name of file to where put data flags[0] - offset flags[1] - maxLen

func FilePutContents Uses

func FilePutContents(fileName, data string, flags ...interface{}) (int, error)

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 Uses

func GetMxrr(domain string) (isMx bool, mxs []*net.MX, err error)

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 Uses

func HTTPBuildQuery(pairs map[string]string) string

HTTPBuildQuery Generates a URL-encoded query string from the associative map

func HashFile Uses

func HashFile(algo, fileName string) (string, error)

HashFile hashs file fileName by calculating hash md5/sha1/sha2 based on it's content

func IP2long Uses

func IP2long(ipAddr string) (uint32, error)

IP2long converts a string containing an (IPv4) Internet Protocol dotted address into a long integer

func InArray Uses

func InArray(needle interface{}, haystack interface{}) bool

InArray checks if a value exists in an array

func IsDir Uses

func IsDir(fileName string) bool

IsDir tells whether the filename is a directory

func IsFile Uses

func IsFile(fileName string) bool

IsFile tells whether the filename is a regular file

func IsLink(fileName string) bool

IsLink tells whether the filename is a symbolic link

func Long2ip Uses

func Long2ip(ipLong uint32) string

Long2ip converts an long integer address into a string in (IPv4) Internet standard dotted format

func Md5 Uses

func Md5(s string) string

Md5 returns simple md5 in hex generated from string s

func Rand Uses

func Rand(min, max int64) int64

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 Uses

func Range(min, max int, step ...interface{}) []int

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 Serialize Uses

func Serialize(val interface{}) (string, error)

Serialize encodes Go code entities to string for e.g.: later storage

func Sha1 Uses

func Sha1(s string) string

Sha1 returns simple sha1 in hex generated from string s

func Sha2 Uses

func Sha2(s string) string

Sha2 returns simple sha1 in hex generated from string s

func StrIReplace Uses

func StrIReplace(args ...interface{}) (string, error)

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 Uses

func StrReplace(args ...interface{}) (string, error)

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 UnixMicro Uses

func UnixMicro() int64

UnixMicro microseconds since unix epoch

func UnixMilli Uses

func UnixMilli() int64

UnixMilli milliseconds since unix epoch

func Unserialize Uses

func Unserialize(val string, v interface{}) error

Unserialize decodes string back into Go code representation

type Context Uses

type Context struct {
    Headers           map[string]string
    RequestMethod     string
    Req               *http.Request
    UploadMaxFileSize int64
}

Context is the opts for http/net requests

func NewContext Uses

func NewContext() *Context

NewContext returns a new Context with preset default headers and request method

func (*Context) MoveUploadedFile Uses

func (c *Context) MoveUploadedFile(fieldName, destination string) bool

MoveUploadedFile uploads file from fieldName to destination path

type Item Uses

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 Uses

type PriorityQueue []*Item

A PriorityQueue implements heap.Interface and holds Items.

func (*PriorityQueue) Init Uses

func (pq *PriorityQueue) Init()

func (PriorityQueue) Len Uses

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less Uses

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop Uses

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) Push Uses

func (pq *PriorityQueue) Push(x interface{})

func (PriorityQueue) Swap Uses

func (pq PriorityQueue) Swap(i, j int)

func (*PriorityQueue) Update Uses

func (pq *PriorityQueue) Update(item *Item, value string, priority int)

update modifies the Priority and Value of an Item in the queue.

type Time Uses

type Time time.Time

func (Time) Microseconds Uses

func (t Time) Microseconds() int64

Microsecond from time.Time Go type

func (Time) Milliseconds Uses

func (t Time) Milliseconds() int64

Milliseconds from time.Time Go type

Directories

PathSynopsis
html

Package pgo imports 25 packages (graph). Updated 2020-06-01. Refresh now. Tools for package owners.