{"modulePath":"github.com/CHESSComputing/DataBookkeeping","version":"v0.0.0-dev5","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package utils\n\n## Variables\n\n```go\nvar BASE string\n```\nBASE represents /base path of dbs2go end-point\n\n```go\nvar Localhost string\n```\nLocalhost represents localhost name (with port) which can be used for local HTTP requests\n\n```go\nvar ORACLE bool\n```\nORACLE represents a flag that underlying DB is oracle\n\n```go\nvar STATICDIR string\n```\nSTATICDIR holds location of static directory for dbs2go\n\n```go\nvar VERBOSE int\n```\nVERBOSE controls verbosity level of the package\n\n## Functions\n\n```go\nfunc BasePath(base, api string) string\n```\nBasePath function provides end-point path for given api string\n\n```go\nfunc CastFloat(val interface{}) (float64, error)\n```\nCastFloat function to check and cast interface{} to int64 data-type\n\n```go\nfunc CastInt(val interface{}) (int, error)\n```\nCastInt function to check and cast interface{} to int data-type\n\n```go\nfunc CastInt64(val interface{}) (int64, error)\n```\nCastInt64 function to check and cast interface{} to int64 data-type\n\n```go\nfunc CastString(val interface{}) (string, error)\n```\nCastString function to check and cast interface{} to string data-type\n\n```go\nfunc ConvertFloat(val string) string\n```\nConvertFloat converts string representation of float scientific number to string int\n\n```go\nfunc Equal[T ListEntry](a, b []T) bool\n```\nEqual tells whether a and b contain the same elements. A nil argument is equivalent to an empty slice.\n\n```go\nfunc ErrPropagate(api string)\n```\nErrPropagate helper function which can be used in defer ErrPropagate()\n\n```go\nfunc ErrPropagate2Channel(api string, ch chan interface{})\n```\nErrPropagate2Channel helper function which can be used in goroutines as ch := make(chan interface{})\n\n\tgo func() {\n\t   defer ErrPropagate2Channel(api, ch)\n\t   someFunction()\n\t}()\n\n```go\nfunc GetHash(data []byte) string\n```\nGetHash generates SHA256 hash for given data blob\n\n```go\nfunc GoDeferFunc(api string, f func())\n```\nGoDeferFunc runs any given function in defered go routine\n\n```go\nfunc InList[T ListEntry](a T, list []T) bool\n```\nInList checks item in a list\n\n```go\nfunc Insert(arr []interface{}, val interface{}) []interface{}\n```\nInsert inserts value into array at zero position\n\n```go\nfunc ListFiles(dir string) []string\n```\nListFiles lists files in a given directory\n\n```go\nfunc MapIntKeys(rec map[int]interface{}) []int\n```\nMapIntKeys returns int keys from a map\n\n```go\nfunc MapKeys(rec map[string]interface{}) []string\n```\nMapKeys returns string keys from a map\n\n```go\nfunc OrderedSet[T ListEntry](list []T) []T\n```\nOrderedSet implementa ordered set\n\n```go\nfunc ParseTmpl(tdir, tmpl string, data interface{}) (string, error)\n```\nParseTmpl parses template with given data\n\n```go\nfunc PrintSQL(stm string, args []interface{}, msg string)\n```\nPrintSQL prints SQL/args\n\n```go\nfunc RecordSize(v interface{}) (int64, error)\n```\nRecordSize returns actual record size of given interface object\n\n```go\nfunc ReplaceBinds(stm string) string\n```\nReplaceBinds replaces given pattern in string\n\n```go\nfunc Set[T ListEntry](arr []T) []T\n```\nSet converts input list into set\n\n```go\nfunc Stack() string\n```\nStack returns full runtime stack\n\n```go\nfunc UpdateOrderedDict(omap, nmap map[int][]string) map[int][]string\n```\nUpdateOrderedDict returns new ordered list from given ordered dicts\n\n## Types\n\n```go\ntype DevNullWriter string\n```\nDevNullWriter provides the same functionality as http.ResponseWriter to cover unit tests of DBS APIs. It prints given data directly to stdout.\n\n```go\nfunc (s DevNullWriter) Header() http.Header\n```\nHeader implements Header() API of http.ResponseWriter interface\n\n```go\nfunc (s DevNullWriter) Write(b []byte) (int, error)\n```\nWrite implements Write API of http.ResponseWriter interface\n\n```go\nfunc (s DevNullWriter) WriteHeader(statusCode int)\n```\nWriteHeader implements WriteHeader API of http.ResponseWriter interface\n\n```go\ntype GzipReader struct {\n\t*gzip.Reader\n\tio.Closer\n}\n```\nGzipReader struct to handle GZip'ed content of HTTP requests\n\n```go\nfunc (gz GzipReader) Close() error\n```\nClose function closes gzip reader\n\n```go\ntype GzipWriter struct {\n\tGzipWriter *gzip.Writer\n\tWriter     http.ResponseWriter\n}\n```\nGzipWriter provides the same functionality as http.ResponseWriter It compresses data using compress/zip writer and provides headers from given http.ResponseWriter\n\n```go\nfunc (g GzipWriter) Header() http.Header\n```\nHeader implements Header() API of http.ResponseWriter interface\n\n```go\nfunc (g GzipWriter) Write(b []byte) (int, error)\n```\nWrite implements Write API of http.ResponseWriter interface\n\n```go\nfunc (g GzipWriter) WriteHeader(statusCode int)\n```\nWriteHeader implements WriteHeader API of http.ResponseWriter interface\n\n```go\ntype ListEntry interface {\n\tint | int64 | float64 | string\n}\n```\nListEntry identifies types used by list's generics function\n\n```go\ntype ProcFS struct {\n\tCpuTotal      float64\n\tVsize         float64\n\tRss           float64\n\tOpenFDs       float64\n\tMaxFDs        float64\n\tMaxVsize      float64\n\tUserCPUs      []float64\n\tSystemCPUs    []float64\n\tSumUserCPUs   float64\n\tSumSystemCPUs float64\n}\n```\nProcFS represents prometheus profcs metrics\n\n```go\nfunc ProcFSMetrics() ProcFS\n```\nProcFSMetrics returns procfs (prometheus) metrics\n\n```go\ntype StdoutWriter string\n```\nStdoutWriter provides the same functionality as http.ResponseWriter to cover unit tests of DBS APIs. It prints given data directly to stdout.\n\n```go\nfunc (s StdoutWriter) Header() http.Header\n```\nHeader implements Header() API of http.ResponseWriter interface\n\n```go\nfunc (s StdoutWriter) Write(b []byte) (int, error)\n```\nWrite implements Write API of http.ResponseWriter interface\n\n```go\nfunc (s StdoutWriter) WriteHeader(statusCode int)\n```\nWriteHeader implements WriteHeader API of http.ResponseWriter interface\n\n","path":"github.com/CHESSComputing/DataBookkeeping/utils","name":"utils","synopsis":"","isRedistributable":true}
