utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(name string) bool

func Expand

func Expand(s string) ([]int, error)

Expand expands a string of the format 1,2,3-5 or * to the valid list of log levels

func Format

func Format(pattern string, values map[string]interface{}) string

Format accepts a string pattern of format "something {key}, something" and replaces all occurences of {<key>} from the values map.

func GetCmdLine added in v1.0.0

func GetCmdLine() map[string]interface{}

GetCmdLine Get kernel cmdline arguments

func GetKeys

func GetKeys(m map[string]interface{}) []string

GetKeys returns the keys of map

func In

func In(l []int, x int) bool

In checks if x is in l

func InString

func InString(l []string, x string) bool

InString checks if x is in l

func LoadTomlFile

func LoadTomlFile(filename string, v interface{}) error

LoadTomlFile loads toml using "github.com/naoina/toml"

func NewRedisPool

func NewRedisPool(network string, address string, password string) *redis.Pool

func Update

func Update(dst map[string]interface{}, src map[string]interface{})

Update updates dst map from value in src

Types

type Buffer

type Buffer interface {
	Append(obj interface{})
}

Buffer interface

func NewBuffer

func NewBuffer(capacity int, flushInt time.Duration, onflush BufferFlush) Buffer

NewBuffer creates a new timed buffer

type BufferFlush

type BufferFlush func([]interface{})

BufferFlush callback type for on flush event

type TimedBuffer

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

TimedBuffer flushes buffer on time or if max buffer size is reached

func (*TimedBuffer) Append

func (buffer *TimedBuffer) Append(obj interface{})

Append appends object to buffer

Jump to

Keyboard shortcuts

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