x

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package x provides some common utilities used by the entire library.

Index

Constants

View Source
const (
	ErrorOk              = "ErrorOk"
	ErrorUnauthorized    = "ErrorUnauthorized"
	ErrorInvalidMethod   = "ErrorInvalidMethod"
	ErrorInvalidRequest  = "ErrorInvalidRequest"
	ErrorMissingRequired = "ErrorMissingRequired"
	Error                = "Error"
	ErrorNoData          = "ErrorNoData"
	ErrorUptodate        = "ErrorUptodate"
	ErrorNoPermission    = "ErrorNoPermission"
)

Error constants representing different types of errors.

Variables

View Source
var Nilbyte []byte

Functions

func AddInit added in v0.4.4

func AddInit(f func())

AddInit adds a function to be run in x.Init, which should be called at the beginning of all mains.

func Err

func Err(entry *logrus.Entry, err error) *logrus.Entry

func Init added in v0.4.4

func Init()

Init initializes flags and run all functions in initFunc.

func Log

func Log(p string) *logrus.Entry

func ParseRequest

func ParseRequest(w http.ResponseWriter, r *http.Request, data interface{}) bool

func Reply

func Reply(w http.ResponseWriter, rep interface{})

func SetError

func SetError(prev *error, n error)

func SetStatus

func SetStatus(w http.ResponseWriter, code, msg string)

func Trace

func Trace(ctx context.Context, format string, args ...interface{})

func UidlistOffset

func UidlistOffset(b *flatbuffers.Builder,
	sorted []uint64) flatbuffers.UOffsetT

Types

type DirectedEdge

type DirectedEdge struct {
	Entity    uint64
	Attribute string
	Value     []byte
	ValueId   uint64
	Source    string
	Timestamp time.Time
}

type Elem

type Elem struct {
	Uid uint64
	Idx int // channel index
}

type Status

type Status struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type Uint64Heap

type Uint64Heap []Elem

func (Uint64Heap) Len

func (h Uint64Heap) Len() int

func (Uint64Heap) Less

func (h Uint64Heap) Less(i, j int) bool

func (*Uint64Heap) Pop

func (h *Uint64Heap) Pop() interface{}

func (*Uint64Heap) Push

func (h *Uint64Heap) Push(x interface{})

func (Uint64Heap) Swap

func (h Uint64Heap) Swap(i, j int)

Jump to

Keyboard shortcuts

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