context

package
v0.0.0-...-428c58b Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

Context provides access to the data store.

func Open

func Open(path string) (*Context, error)

Open the context using path as the data store location.

func (*Context) Close

func (c *Context) Close() error

Close the resources associated with this context.

func (*Context) Del

func (c *Context) Del(key string) error

Del removes an existing shortcut from the data store.

func (*Context) Get

func (c *Context) Get(name string) (*Route, error)

Get retreives a shortcut from the data store.

func (*Context) GetAll

func (c *Context) GetAll() (map[string]Route, error)

GetAll gets everything in the db to dump it out for backup purposes

func (*Context) List

func (c *Context) List(start []byte) *Iter

List all routes in an iterator, starting with the key prefix of start (which can also be nil).

func (*Context) NextID

func (c *Context) NextID() (uint64, error)

NextID generates the next numeric ID to be used for an auto-named shortcut.

func (*Context) Put

func (c *Context) Put(key string, rt *Route) error

Put stores a new shortcut in the data store.

type Iter

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

Iter allows iteration of the named routes in the store.

func (*Iter) Error

func (i *Iter) Error() error

Error returns any active error that has stopped the iterator.

func (*Iter) Name

func (i *Iter) Name() string

Name is the name of the current route.

func (*Iter) Next

func (i *Iter) Next() bool

Next advances the iterator to the next value.

func (*Iter) Release

func (i *Iter) Release()

Release disposes of the resources in the iterator.

func (*Iter) Route

func (i *Iter) Route() *Route

Route is the current route.

func (*Iter) Seek

func (i *Iter) Seek(cur []byte) bool

Seek ...

func (*Iter) Valid

func (i *Iter) Valid() bool

Valid indicates whether the current values of the iterator are valid.

type Route

type Route struct {
	URL  string    `json:"url"`
	Time time.Time `json:"time"`
}

Route is the value part of a shortcut.

Jump to

Keyboard shortcuts

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