lib

package
v0.0.0-...-30e45d9 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2017 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

func MapGet

func MapGet(m cmap.ConcurrentMap, key string) interface{}

MapGet set value to map

func MapHas

func MapHas(m cmap.ConcurrentMap, key string) bool

MapHas key or not

func MapRemove

func MapRemove(m cmap.ConcurrentMap, key string)

MapRemove removes key from map

func MapSet

func MapSet(m cmap.ConcurrentMap, key string, value interface{})

MapSet set value to map

func MulInt

func MulInt(a, b int) int

MulInt multiplis int

func NormalizeMap

func NormalizeMap(data map[string]interface{}) map[string]interface{}

NormalizeMap normalizes data which can't be used for standard yaml or json

func OpenstackDelete

func OpenstackDelete(client *gophercloud.ServiceClient, url string) (interface{}, error)

OpenstackDelete deletes a resource using OpenStack API

func OpenstackEndpoint

func OpenstackEndpoint(client *gophercloud.ServiceClient, endpointType, name, region, availability string) (interface{}, error)

OpenstackEndpoint returns API endpoint for each service name

func OpenstackEnsure

func OpenstackEnsure(client *gophercloud.ServiceClient, url string, postURL string, data interface{}) (interface{}, error)

OpenstackEnsure keep resource status to sync

func OpenstackGet

func OpenstackGet(client *gophercloud.ServiceClient, url string) (interface{}, error)

OpenstackGet gets a resource using OpenStack API

func OpenstackPost

func OpenstackPost(client *gophercloud.ServiceClient, url string, data interface{}) (interface{}, error)

OpenstackPost posts a resource using OpenStack API

func OpenstackPut

func OpenstackPut(client *gophercloud.ServiceClient, url string, data interface{}) (interface{}, error)

OpenstackPut puts a resource using OpenStack API

func OpenstackToken

func OpenstackToken(client *gophercloud.ServiceClient) string

OpenstackToken get auth token from client

func ParseCidr

func ParseCidr(cidr string) (string, int, int)

ParseCidr parse cidr for start ip and number of ips

func ReadConfig

func ReadConfig(path string) error

ReadConfig reads configuraion from file.

func SaveContent

func SaveContent(path string, data interface{}) error

SaveContent saves data for path

func Shift

func Shift(list []interface{}) (interface{}, []interface{})

Shift retrives first element and left

func Size

func Size(list []interface{}) int

Size checks length of a list

func Split

func Split(value, sep string) (interface{}, error)

Split splits value using separator

func Stop

func Stop(queue *job.Queue)

Stop stops work queue

func StopTestServer

func StopTestServer(server *httptest.Server)

StopTestServer stops test server

func SubInt

func SubInt(a, b int) int

SubInt substructs int

func UUID

func UUID() string

UUID makes uuidv4

func Unshift

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

Unshift pushes an item on the beginnings

func WaitQueue

func WaitQueue(queue *job.Queue)

WaitQueue waits queue get empty

Types

This section is empty.

Jump to

Keyboard shortcuts

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