Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

Backend provides access to Google Firestore.

func New

func New(ctx context.Context, path string) (*Backend, error)

New instantiates a new Backend

func (*Backend) Close

func (backend *Backend) Close() error

Close the resources associated with this backend.

func (*Backend) Del

func (backend *Backend) Del(ctx context.Context, key string) error

Del removes an existing shortcut from the data store.

func (*Backend) Get

func (backend *Backend) Get(ctx context.Context, name string) (*internal.Route, error)

Get retreives a shortcut from the data store.

func (*Backend) GetAll

func (backend *Backend) GetAll(ctx context.Context) (map[string]internal.Route, error)

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

func (*Backend) List

func (backend *Backend) List(ctx context.Context, start string) (internal.RouteIterator, error)

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

func (*Backend) NextID

func (backend *Backend) NextID(ctx context.Context) (uint64, error)

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

func (*Backend) Put

func (backend *Backend) Put(ctx context.Context, key string, rt *internal.Route) error

Put stores a new shortcut in the data store.

type NextID

type NextID struct {
	ID uint32 `json:"id" firestore:"id"`
}

NextID is the next numeric ID to use for auto-generated IDs

type RouteIterator

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

RouteIterator allows iteration of the named routes in firestore.

func (*RouteIterator) Error

func (i *RouteIterator) Error() error

Error returns any active error that has stopped the iterator.

func (*RouteIterator) Name

func (i *RouteIterator) Name() string

Name is the name of the current route.

func (*RouteIterator) Next

func (i *RouteIterator) Next() bool

Next advances the iterator to the next value.

func (*RouteIterator) Release

func (i *RouteIterator) Release()

Release disposes of the resources in the iterator.

func (*RouteIterator) Route

func (i *RouteIterator) Route() *internal.Route

Route is the current route.

func (*RouteIterator) Seek

func (i *RouteIterator) Seek(cur string) bool

Seek ...

func (*RouteIterator) Valid

func (i *RouteIterator) Valid() bool

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