common

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

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

Go to latest
Published: May 30, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Read = iota
	Write
	Delete
)

Variables

View Source
var Commandtypes = [...]string{
	"Read",
	"Write",
	"Delete",
}

Functions

This section is empty.

Types

type CommandType

type CommandType int8

func (CommandType) String

func (ct CommandType) String() string

type ErrSyntax

type ErrSyntax struct {
	Line   int
	Source string // The contents of the erroneous line, without leading or trailing whitespace
}

ErrSyntax is returned when there is a syntax error in an INI file.

func (ErrSyntax) Error

func (e ErrSyntax) Error() string

type File

type File map[string]Section

A File represents a parsed INI file.

func Load

func Load(in io.Reader) (File, error)

Loads and returns a File from a reader.

func LoadFile

func LoadFile(filename string) (File, error)

Loads and returns an INI File from a file on disk.

func (File) Get

func (f File) Get(section, key string) (value string, ok bool)

Looks up a value for a key in a section and returns that value, along with a boolean result similar to a map lookup.

func (File) Load

func (f File) Load(in io.Reader) (err error)

Loads INI data from a reader and stores the data in the File.

func (File) LoadFile

func (f File) LoadFile(file string) (err error)

Loads INI data from a named file and stores the data in the File.

func (File) Section

func (f File) Section(name string) Section

Returns a named Section. A Section will be created if one does not already exist for the given name.

type MapRequest

type MapRequest struct {
	Ct    CommandType
	Key   []byte
	Value []byte
}

func (*MapRequest) BinarySize

func (t *MapRequest) BinarySize() (nbytes int, sizeKnown bool)

func (*MapRequest) Marshal

func (t *MapRequest) Marshal(wire io.Writer)

func (MapRequest) String

func (req MapRequest) String() string

func (*MapRequest) Unmarshal

func (t *MapRequest) Unmarshal(rr io.Reader) error

type MapRequestCache

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

func NewMapRequestCache

func NewMapRequestCache() *MapRequestCache

func (*MapRequestCache) Get

func (p *MapRequestCache) Get() *MapRequest

func (*MapRequestCache) Put

func (p *MapRequestCache) Put(t *MapRequest)

type MapResponse

type MapResponse struct {
	ToType CommandType
	Value  []byte
	Found  byte
	Err    []byte
}

func (*MapResponse) BinarySize

func (t *MapResponse) BinarySize() (nbytes int, sizeKnown bool)

func (*MapResponse) Marshal

func (t *MapResponse) Marshal(wire io.Writer)

func (MapResponse) String

func (resp MapResponse) String() string

func (*MapResponse) Unmarshal

func (t *MapResponse) Unmarshal(rr io.Reader) error

type MapResponseCache

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

func NewMapResponseCache

func NewMapResponseCache() *MapResponseCache

func (*MapResponseCache) Get

func (p *MapResponseCache) Get() *MapResponse

func (*MapResponseCache) Put

func (p *MapResponseCache) Put(t *MapResponse)

type Section

type Section map[string]string

A Section represents a single section of an INI file.

Jump to

Keyboard shortcuts

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