lib

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddInt

func AddInt(a, b int) int

AddInt adds int

func Append

func Append(list []interface{}, value interface{}) []interface{}

Append add element to the list and return new list.

func ConnectDB

func ConnectDB(dbType string, connection string, maxOpenConn int) (db.DB, error)

ConnectDB start connection to db

func Contains

func Contains(list []interface{}, value interface{}) bool

Contains checks if a value is in a list.

func Copy

func Copy(list []interface{}) []interface{}

Copy copies a list

func CounterAdd

func CounterAdd(counter *util.Counter, value int)

CounterAdd makes thread safe counter

func CounterValue

func CounterValue(counter *util.Counter) int

CounterValue makes thread safe counter

func DBBegin

func DBBegin(connection db.DB) (transaction.Transaction, error)

DBBegin starts transaction

func DBClose

func DBClose(tx transaction.Transaction) error

DBClose closes a transaction.

func DBColumn

func DBColumn(schemaID string, join bool) (string, error)

DBColumn makes partiall part of sql query from schema

func DBCommit

func DBCommit(tx transaction.Transaction) error

DBCommit commits transaction

func DBCreate

func DBCreate(tx transaction.Transaction, schemaID string, data map[string]interface{}) error

DBCreate creates a resource in a db.

func DBDelete

func DBDelete(tx transaction.Transaction, schemaID string, id string) error

DBDelete deletes a resource in a db.

func DBExec

func DBExec(tx transaction.Transaction, sql string, arguments []interface{}) error

DBExec closes a transaction.

func DBGet

func DBGet(tx transaction.Transaction, schemaID string, id string, tenantID string) (map[string]interface{}, error)

DBGet get resource from a db.

func DBList

func DBList(tx transaction.Transaction, schemaID string, filter map[string]interface{}) ([]interface{}, error)

DBList lists data from database.

func DBQuery

func DBQuery(tx transaction.Transaction, schemaID string, sql string, arguments []interface{}) ([]interface{}, error)

DBQuery fetchs data from db with additional query

func DBUpdate

func DBUpdate(tx transaction.Transaction, schemaID string, data map[string]interface{}) error

DBUpdate updates a resource in a db.

func Delete

func Delete(list []interface{}, index int) []interface{}

Delete deletes an item from list

func DivInt

func DivInt(a, b int) int

DivInt divieds int

func Env

func Env() map[string]interface{}

Env returns map of env values

func Error

func Error(code int, name, message string) error

Error returns extension Error

func FetchContent

func FetchContent(path string) (interface{}, error)

FetchContent fetch contents from arbitrary path

func First

func First(list []interface{}) interface{}

First return the first element

func FloatToInt

func FloatToInt(value float64) int

FloatToInt converts float to int

func ForceStop

func ForceStop(queue *job.Queue)

ForceStop force stop queue

func FormatUUID

func FormatUUID(uuid string) (string, error)

FormatUUID format uuidv4

func GetConfig

func GetConfig(key string, defaultValue interface{}) interface{}

GetConfig returns config by key.

func GetOpenstackClient

func GetOpenstackClient(authURL, userName, password, domainName, tenantName, tenantID, version string) (*gophercloud.ServiceClient, error)

GetOpenstackClient makes openstack client

func GetTestServerURL

func GetTestServerURL(server *httptest.Server) string

GetTestServerURL returns URL of ts

func GohanLoadSchema

func GohanLoadSchema(src string) (interface{}, error)

GohanLoadSchema loads schema from path.

func GohanPolicies

func GohanPolicies() []*schema.Policy

GohanPolicies returns all policies

func GohanSchema

func GohanSchema(schemaID string) (*schema.Schema, error)

GohanSchema returns gohan schema object by schemaID.

func GohanSchemas

func GohanSchemas() schema.Map

GohanSchemas returns map of schemas.

func GohanServer

func GohanServer(configFile string, test bool) (interface{}, error)

GohanServer starts gohan server from configFile

func HTTPDelete

func HTTPDelete(url string, headers map[string]interface{}) (interface{}, error)

HTTPDelete deletes data using HTTP.

func HTTPGet

func HTTPGet(url string, headers map[string]interface{}) (map[string]interface{}, error)

HTTPGet fetch data using HTTP.

func HTTPPatch

func HTTPPatch(url string, headers map[string]interface{}, postData map[string]interface{}) (map[string]interface{}, error)

HTTPPatch patches data using HTTP.

func HTTPPost

func HTTPPost(url string, headers map[string]interface{}, postData map[string]interface{}) (map[string]interface{}, error)

HTTPPost posts data using HTTP.

func HTTPPut

func HTTPPut(url string, headers map[string]interface{}, postData map[string]interface{}) (map[string]interface{}, error)

HTTPPut puts data using HTTP.

func HTTPRequest

func HTTPRequest(url string, method string, headers map[string]interface{}, postData map[string]interface{}) (map[string]interface{}, error)

HTTPRequest request HTTP.

func IPAdd

func IPAdd(ip string, value int) string

IPAdd adds int for ip

func IPToInt

func IPToInt(ip string) int

IPToInt converts ip string to int

func InitDB

func InitDB(dbType string, connection string, dropOnCreate bool, cascade bool) error

InitDB initializes database using schema.

func IntToIP

func IntToIP(value int) string

IntToIP converts int to ip string

func Join

func Join(value []interface{}, sep string) (interface{}, error)

Join joins list using separator

func Last

func Last(list []interface{}) interface{}

Last return the last element

func MakeCounter

func MakeCounter(value int) *util.Counter

MakeCounter makes thread safe counter

func MakeMap

func MakeMap() cmap.ConcurrentMap

MakeMap makes thread safe map

func MakeQueue

func MakeQueue(workers int) *job.Queue

MakeQueue makes new worker queue with specfied workers