common

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2014 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WrongNumberOfArguments = iota
	InvalidArgument
	InternalError
)
View Source
const (
	Day   = 24 * time.Hour
	Week  = 7 * Day
	Month = 30 * Day
	Year  = 365 * Day
)
View Source
const (
	TYPE_UNKNOWN = iota
	TYPE_INT
	TYPE_STRING
	TYPE_BOOL
	TYPE_DOUBLE
)

Variables

View Source
var (
	TRUE  = true
	FALSE = false
)

Functions

func ConvertToDataStoreSeries

func ConvertToDataStoreSeries(s ApiSeries, precision TimePrecision) (*protocol.Series, error)

func CurrentTime

func CurrentTime() int64

func GetFileSize

func GetFileSize(path string) (int64, error)

func IsIrregularInterval added in v0.8.4

func IsIrregularInterval(value string) bool

func MergeSeries

func MergeSeries(s1, s2 *protocol.Series) *protocol.Series

merges two time series making sure that the resulting series has the union of the two series columns and the values set properly. will panic if the two series don't have the same name

func ParseTimeDuration

func ParseTimeDuration(value string) (int64, error)

Returns the parsed duration in nanoseconds, support 'u', 's', 'm', 'h', 'd', 'W', 'M', and 'Y' suffixes.

func RecoverFunc

func RecoverFunc(database, query string, cleanup func(err interface{}))

func SortSerializedSeries

func SortSerializedSeries(s []*SerializedSeries)

func StringToSeriesArray

func StringToSeriesArray(seriesString string, args ...interface{}) ([]*protocol.Series, error)

func TimeFromMicroseconds added in v0.8.4

func TimeFromMicroseconds(t int64) time.Time

func TimeToMicroseconds

func TimeToMicroseconds(t time.Time) int64

Types

type ApiSeries

type ApiSeries interface {
	GetName() string
	GetColumns() []string
	GetPoints() [][]interface{}
}

type AuthenticationError

type AuthenticationError string

func NewAuthenticationError

func NewAuthenticationError(formatStr string, args ...interface{}) AuthenticationError

func (AuthenticationError) Error

func (self AuthenticationError) Error() string

type AuthorizationError

type AuthorizationError string

func NewAuthorizationError

func NewAuthorizationError(formatStr string, args ...interface{}) AuthorizationError

func (AuthorizationError) Error

func (self AuthorizationError) Error() string

type BySerializedSeriesNameAsc

type BySerializedSeriesNameAsc struct{ SerializedSeriesCollection }

func (BySerializedSeriesNameAsc) Less

func (s BySerializedSeriesNameAsc) Less(i, j int) bool

type DatabaseExistsError

type DatabaseExistsError string

func NewDatabaseExistsError

func NewDatabaseExistsError(db string) DatabaseExistsError

func (DatabaseExistsError) Error

func (self DatabaseExistsError) Error() string

type ErrorWithStacktrace

type ErrorWithStacktrace struct {
	// contains filtered or unexported fields
}

An error that remembers where it was thrown from

func NewErrorWithStacktrace

func NewErrorWithStacktrace(cause error, msg ...interface{}) *ErrorWithStacktrace

if msg is provided, msg is treated as the error message and the error is treated as the original cause of this error. Otherwise the error is used as the error message. This is useful for chaining multiple errors to trace what was the original error that triggered the subsequent errors

func (*ErrorWithStacktrace) Error

func (self *ErrorWithStacktrace) Error() string

type QueryError

type QueryError struct {
	ErrorCode int
	ErrorMsg  string
}

func NewQueryError

func NewQueryError(code int, msg string, args ...interface{}) *QueryError

func (*QueryError) Error

func (self *QueryError) Error() string

type SerializedSeries

type SerializedSeries struct {
	Name    string          `json:"name"`
	Columns []string        `json:"columns"`
	Points  [][]interface{} `json:"points"`
}

func SerializeSeries

func SerializeSeries(memSeries map[string]*protocol.Series, precision TimePrecision) []*SerializedSeries

takes a slice of protobuf series and convert them to the format that the http api expect

func (*SerializedSeries) GetColumns

func (self *SerializedSeries) GetColumns() []string

func (*SerializedSeries) GetName

func (self *SerializedSeries) GetName() string

func (*SerializedSeries) GetPoints

func (self *SerializedSeries) GetPoints() [][]interface{}

type SerializedSeriesCollection

type SerializedSeriesCollection []*SerializedSeries

func (SerializedSeriesCollection) Len

func (SerializedSeriesCollection) Swap

func (s SerializedSeriesCollection) Swap(i, j int)

type TimePrecision

type TimePrecision int
const (
	MicrosecondPrecision TimePrecision = iota
	MillisecondPrecision
	SecondPrecision
)

type Type

type Type int

func CoerceValues

func CoerceValues(leftValue, rightValue *protocol.FieldValue) (interface{}, interface{}, Type)

func (Type) String added in v0.8.4

func (t Type) String() string

type User

type User interface {
	GetName() string
	IsDeleted() bool
	IsClusterAdmin() bool
	IsDbAdmin(db string) bool
	GetDb() string
	HasWriteAccess(name string) bool
	GetWritePermission() string
	HasReadAccess(name string) bool
	GetReadPermission() string
}

Jump to

Keyboard shortcuts

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