tools

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cache = Ca{}
View Source
var Langs = map[string]map[string]string{}/* 206 elements not displayed */
View Source
var NoExpiration = cache.NoExpiration

Functions

func ArrayKeys

func ArrayKeys(mmap map[interface{}]interface{}) (keys []interface{})

ArrayKeys returns the keys of a map as an array

func Call

func Call(obj interface{}, name string, args ...interface{}) []reflect.Value

Call calls the function of obj by name

func Ck

func Ck(set interface{}) bool

Ck checks if value is empty

func ConvertUtf8

func ConvertUtf8(stream io.ReadCloser) io.Reader

ConvertUtf8 takes a stream and returns it into a reader converting the bytes to utf8

func GzipString

func GzipString(s string) string

GzipString encodes a string

func Headers

func Headers(w *http.ResponseWriter)

func Keys

func Keys(v interface{}) ([]string, error)

Keys is like ArrayKeys, except it is safer and uses reflection

func MapString

func MapString(m MII, glue string, order SI) string

MapString joins the elements of a map in string

func MbSubstr

func MbSubstr(s string, from, length int) string

https://gist.github.com/sisteamnik/c866cb7eed264ea3408d MbSubstr get a multibyte wise substring

func Must

func Must(i interface{}, err error) interface{}

Must returns the value of a value, error function

func ParseUrls

func ParseUrls(urls map[string]string) map[string]*url.URL

ParseUrls returns a map of parsed url provided a map of string urls

func RegSplit

func RegSplit(text string, delimeter string, keep bool) []string

RegSplit http://stackoverflow.com/a/14765076/2229761

func Reverse

func Reverse(s string) string

Reverse reverts the order of a string using runes (mb safe)

func Seconds

func Seconds(secs int) time.Duration

Types

type Ca

type Ca struct {
	*cache.Cache
}

func (Ca) GetBytes

func (c Ca) GetBytes(key string) interface{}

func (Ca) Init

func (c Ca) Init()

func (Ca) Save

func (c Ca) Save()

func (Ca) SetBytes

func (c Ca) SetBytes(key string, value interface{}) error

func (Ca) ToBytes

func (c Ca) ToBytes(value interface{}) ([]byte, error)

func (Ca) ToTypes

func (c Ca) ToTypes(bts []byte) interface{}

type I

type I interface{}

struct needs points to be assigned directly (with [k] = v instead of {k:v}

type LanguageCode

type LanguageCode struct {
	Langs *map[string]map[string]string
}

func (*LanguageCode) Convert

func (lc *LanguageCode) Convert(value string) string

type MII

type MII map[I]I

type MISI

type MISI map[I][]I

type SI

type SI []I

type SMII

type SMII []MII

type TextReq

type TextReq struct {
	RgxMain *regexp.Regexp
	Rgx     map[string]*regexp.Regexp
}

func NewTextReq

func NewTextReq() *TextReq

func (*TextReq) Pt

func (txtrq *TextReq) Pt(input map[string]*string, glue string, limit int, service *string) (SMII, MISI)

NOTE: this algo does not always return the same values because it ranges over a map, which means that depending on strings lenghts mapped, the linear chars + strl check differs depending on which string is being iterated. Any more complex non linear normalization that would return a consistent value is not really worth the effort since requests are split and unordered anyway. The fact that it returns different values means that requests for the same map of strings can vary up to n * sumof(input[k])

func (*TextReq) SetRegex

func (txtrq *TextReq) SetRegex(service *string, limit int)

func (*TextReq) SplitP

func (txtrq *TextReq) SplitP(str *string, service *string) []string

type UA

type UA struct {
	// contains filtered or unexported fields
}

func (*UA) Get

func (ua *UA) Get() string

func (*UA) New

func (ua *UA) New() *UA

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL