Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FirestoreBackend

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

FirestoreBackend provides access to Google Firestore.

func New

func New(path string) (*FirestoreBackend, error)

New instantiates a new FirestoreBackend

func (*FirestoreBackend) Close

func (backend *FirestoreBackend) Close() error

Close the resources associated with this backend.

func (*FirestoreBackend) Del

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

Del removes an existing shortcut from the data store.

func (*FirestoreBackend) Get

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

Get retreives a shortcut from the data store.

func (*FirestoreBackend) GetAll

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

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

func (*FirestoreBackend) List

func (backend *FirestoreBackend) 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 (*FirestoreBackend) NextID

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

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

func (*FirestoreBackend) Put

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

Put stores a new shortcut in the data store.

type FirestoreRouteIterator

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

FirestoreRouteIterator allows iteration of the named routes in firestore.

func (*FirestoreRouteIterator) Error

func (i *FirestoreRouteIterator) Error() error

Error returns any active error that has stopped the iterator.

func (*FirestoreRouteIterator) Name

func (i *FirestoreRouteIterator) Name() string

Name is the name of the current route.

func (*FirestoreRouteIterator) Next

func (i *FirestoreRouteIterator) Next() bool

Next advances the iterator to the next value.

func (*FirestoreRouteIterator) Release

func (i *FirestoreRouteIterator) Release()

Release disposes of the resources in the iterator.

func (*FirestoreRouteIterator) Route

Route is the current route.

func (*FirestoreRouteIterator) Seek

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

Seek ...

func (*FirestoreRouteIterator) Valid

func (i *FirestoreRouteIterator) Valid() bool

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

type NextID

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

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