Documentation ¶
Index ¶
- Variables
- func BasePath(base, api string) string
- func CastFloat(val interface{}) (float64, error)
- func CastInt(val interface{}) (int, error)
- func CastInt64(val interface{}) (int64, error)
- func CastString(val interface{}) (string, error)
- func ConvertFloat(val string) string
- func Equal[T ListEntry](a, b []T) bool
- func ErrPropagate(api string)
- func ErrPropagate2Channel(api string, ch chan interface{})
- func GetHash(data []byte) string
- func GoDeferFunc(api string, f func())
- func HttpClient() *http.Client
- func HttpGet(rurl string, headers map[string]string) (*http.Response, error)
- func HttpPost(rurl string, headers map[string]string, buffer *bytes.Buffer) (*http.Response, error)
- func HttpPostForm(rurl string, headers map[string]string, formData url.Values) (*http.Response, error)
- func InList[T ListEntry](a T, list []T) bool
- func Insert(arr []interface{}, val interface{}) []interface{}
- func ListFiles(dir string) []string
- func MapIntKeys(rec map[int]interface{}) []int
- func MapKeys(rec map[string]interface{}) []string
- func OrderedSet[T ListEntry](list []T) []T
- func ParseTmpl(tdir, tmpl string, data interface{}) (string, error)
- func PrintSQL(stm string, args []interface{}, msg string)
- func ReadToken(r string) string
- func RecordSize(v interface{}) (int64, error)
- func ReplaceBinds(stm string) string
- func Response(rurl string, data []byte) []byte
- func Set[T ListEntry](arr []T) []T
- func Stack() string
- func UpdateOrderedDict(omap, nmap map[int][]string) map[int][]string
- type DevNullWriter
- type GzipReader
- type GzipWriter
- type ListEntry
- type ResponseType
- type StdoutWriter
Constants ¶
This section is empty.
Variables ¶
var TIMEOUT int
TIMEOUT defines timeout for net/url request
var UrlCounter uint32
UrlCounter for profile output
var VERBOSE int
VERBOSE defines verbosity level
var Verbose int
Verbose controls verbosity level of function printouts
Functions ¶
func CastString ¶
CastString function to check and cast interface{} to string data-type
func ConvertFloat ¶
ConvertFloat converts string representation of float scientific number to string int
func Equal ¶
Equal tells whether a and b contain the same elements. A nil argument is equivalent to an empty slice.
func ErrPropagate ¶
func ErrPropagate(api string)
ErrPropagate helper function which can be used in defer ErrPropagate()
func ErrPropagate2Channel ¶
func ErrPropagate2Channel(api string, ch chan interface{})
ErrPropagate2Channel helper function which can be used in goroutines as ch := make(chan interface{})
go func() { defer ErrPropagate2Channel(api, ch) someFunction() }()
func GoDeferFunc ¶
func GoDeferFunc(api string, f func())
GoDeferFunc runs any given function in defered go routine
func HttpPostForm ¶
func HttpPostForm(rurl string, headers map[string]string, formData url.Values) (*http.Response, error)
HttpPostForm performs HTTP POST form request with bearer token
func Insert ¶
func Insert(arr []interface{}, val interface{}) []interface{}
Insert inserts value into array at zero position
func MapIntKeys ¶
MapIntKeys returns int keys from a map
func RecordSize ¶
RecordSize returns actual record size of given interface object
func ReplaceBinds ¶
ReplaceBinds replaces given pattern in string
Types ¶
type DevNullWriter ¶
type DevNullWriter string
DevNullWriter provides the same functionality as http.ResponseWriter to cover unit tests of DBS APIs. It prints given data directly to stdout.
func (DevNullWriter) Header ¶
func (s DevNullWriter) Header() http.Header
Header implements Header() API of http.ResponseWriter interface
func (DevNullWriter) Write ¶
func (s DevNullWriter) Write(b []byte) (int, error)
Write implements Write API of http.ResponseWriter interface
func (DevNullWriter) WriteHeader ¶
func (s DevNullWriter) WriteHeader(statusCode int)
WriteHeader implements WriteHeader API of http.ResponseWriter interface
type GzipReader ¶
GzipReader struct to handle GZip'ed content of HTTP requests
type GzipWriter ¶
type GzipWriter struct { GzipWriter *gzip.Writer Writer http.ResponseWriter }
GzipWriter provides the same functionality as http.ResponseWriter It compresses data using compress/zip writer and provides headers from given http.ResponseWriter
func (GzipWriter) Header ¶
func (g GzipWriter) Header() http.Header
Header implements Header() API of http.ResponseWriter interface
func (GzipWriter) Write ¶
func (g GzipWriter) Write(b []byte) (int, error)
Write implements Write API of http.ResponseWriter interface
func (GzipWriter) WriteHeader ¶
func (g GzipWriter) WriteHeader(statusCode int)
WriteHeader implements WriteHeader API of http.ResponseWriter interface
type ResponseType ¶
type ResponseType struct { Url string // response url Data []byte // response data, i.e. what we got with Body of the response Error error // http error, a non-2xx return code is not an error Status string // http status string StatusCode int // http status code }
ResponseType structure is what we expect to get for our URL call. It contains a request URL, the data chunk and possible error from remote
func FetchResponse ¶
func FetchResponse(rurl string, args []byte) ResponseType
FetchResponse fetches data for provided URL, args is a json dump of arguments
type StdoutWriter ¶
type StdoutWriter string
StdoutWriter provides the same functionality as http.ResponseWriter to cover unit tests of DBS APIs. It prints given data directly to stdout.
func (StdoutWriter) Header ¶
func (s StdoutWriter) Header() http.Header
Header implements Header() API of http.ResponseWriter interface
func (StdoutWriter) Write ¶
func (s StdoutWriter) Write(b []byte) (int, error)
Write implements Write API of http.ResponseWriter interface
func (StdoutWriter) WriteHeader ¶
func (s StdoutWriter) WriteHeader(statusCode int)
WriteHeader implements WriteHeader API of http.ResponseWriter interface