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 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 RecordSize(v interface{}) (int64, error)
- func ReplaceBinds(stm string) string
- 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 ProcFS
- type StdoutWriter
Constants ¶
This section is empty.
Variables ¶
var BASE string
BASE represents /base path of dbs2go end-point
var Localhost string
Localhost represents localhost name (with port) which can be used for local HTTP requests
var ORACLE bool
ORACLE represents a flag that underlying DB is oracle
var STATICDIR string
STATICDIR holds location of static directory for dbs2go
var VERBOSE int
VERBOSE controls verbosity level of the package
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 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 ProcFS ¶
type ProcFS struct { CpuTotal float64 Vsize float64 Rss float64 OpenFDs float64 MaxFDs float64 MaxVsize float64 UserCPUs []float64 SystemCPUs []float64 SumUserCPUs float64 SumSystemCPUs float64 }
ProcFS represents prometheus profcs metrics
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