common

package
v0.0.0-...-ac186bf Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FlAddr = cli.StringFlag{
		Name:  "addr",
		Usage: "<ip>:<port> to listen on",
		Value: "127.0.0.1:8101",
	}

	FlZkAddr = cli.StringFlag{
		Name:  "zk-addr",
		Usage: "<ip>[:<port>] to bind to",
		Value: "127.0.0.1:2181",
	}
)

Functions

func CreateParents

func CreateParents(c IZk, path string, data []byte) error

func NewRouter

func NewRouter(ctx context.Context, routes map[string]map[string]Handler) *mux.Router

func ReadLine

func ReadLine(name string) ([]byte, error)

func Run

func Run(name string, commands ...cli.Command)

func ServeCmd

func ServeCmd(c *cli.Context, ctx context.Context, routes map[string]map[string]Handler) error

func ValidateEmail

func ValidateEmail(email string) bool

Types

type Handler

type Handler func(ctx context.Context, w http.ResponseWriter, r *http.Request) *HttpError

type HttpError

type HttpError struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Status      int    `json:"-"`
}

func NewHttpError

func NewHttpError(description string, status int) *HttpError

type IZk

type IZk interface {
	Children(path string) ([]string, *zk.Stat, error)
	Create(path string, data []byte, flags int32, acl []zk.ACL) (string, error)
	Delete(path string, version int32) error
	Exists(path string) (bool, *zk.Stat, error)
	Get(path string) ([]byte, *zk.Stat, error)
}

Jump to

Keyboard shortcuts

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