shell

package
v0.0.0-...-7a0528a Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2016 License: MIT Imports: 16 Imported by: 0

README

bucketstore shell

An interactive shell for bucketstore. This is a experimental implementation not stable!

Documentation

Index

Constants

View Source
const (
	DataTypeHexBytes = 0
	DataTypeInt      = 1
	DataTypeFloat    = 2
	DataTypeString   = 3
	DataTypeTerm     = 4
)

Variables

View Source
var Cmds = map[string]CmdFunc{
	"exit":    doExit,
	"help":    doHelp,
	"buckets": doBuckets,
	"put":     doPut,
	"post":    doPost,
	"get":     doGet,
	"delete":  doDelete,
	"select":  doSelect,
}

Functions

This section is empty.

Types

type CmdFunc

type CmdFunc func(sh *Shell, args []*Token) (*Response, error)

type Response

type Response struct {
	Status  string      `json:"status"`
	Count   uint64      `json:"count,omitempty"`
	Bucket  string      `json:"bucket,omitempty"`
	Message string      `json:"message,omitempty"`
	Body    interface{} `json:"body,omitempty"`
}

type Shell

type Shell struct {
	DB      *bucketstore.DB
	Path    string
	Options *bucketstore.Options

	Stdin  *os.File
	Stdout *os.File
	Stderr *os.File
	// contains filtered or unexported fields
}

func NewShell

func NewShell() *Shell

func (*Shell) ExecCommand

func (sh *Shell) ExecCommand(line string) error

func (*Shell) Exit

func (sh *Shell) Exit()

func (*Shell) Run

func (sh *Shell) Run() error

type Token

type Token struct {
	Buf      string
	DataType uint
}

func Tokenize

func Tokenize(line string) ([]*Token, error)

tokenize

func (*Token) ToBytes

func (t *Token) ToBytes() ([]byte, error)

func (*Token) ToMustBytes

func (t *Token) ToMustBytes() []byte

func (*Token) ToMustValue

func (t *Token) ToMustValue() interface{}

func (*Token) ToValue

func (t *Token) ToValue() (interface{}, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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