Documentation ¶
Index ¶
- Variables
- func IsFailedDecode(err error) (string, bool)
- type DB
- type FailedDecodeError
- type FirestoreDB
- func (d *FirestoreDB) Close() error
- func (d *FirestoreDB) Delete(ctx context.Context, rollerID string) error
- func (d *FirestoreDB) Get(ctx context.Context, rollerID string) (*config.Config, error)
- func (d *FirestoreDB) GetAll(ctx context.Context) ([]*config.Config, error)
- func (d *FirestoreDB) Put(ctx context.Context, rollerID string, cfg *config.Config) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = errors.New("Request with given ID does not exist.")
)
Functions ¶
func IsFailedDecode ¶
IsFailedDecode determines whether the error is a failure to decode the config for a roller, and if so returns the ID of the roller and true.
Types ¶
type DB ¶
type DB interface { // Close cleans up resources associated with the DB. Close() error // Get returns the Config for the given roller. Get(ctx context.Context, rollerID string) (*config.Config, error) // GetAll returns Configs for all known rollers. GetAll(ctx context.Context) ([]*config.Config, error) // Put inserts the Config into the DB. Implementations MUST validate the // Config before inserting into the DB. Put(ctx context.Context, rollerID string, cfg *config.Config) error // Delete removes the Config for the given roller from the DB. Delete(ctx context.Context, rollerID string) error }
DB provides methods for interacting with a database of Configs.
type FailedDecodeError ¶
FailedDecodeError is an Error indicating that we failed to decode the config for a roller.
func (*FailedDecodeError) Error ¶
func (e *FailedDecodeError) Error() string
Error implements error.
type FirestoreDB ¶
type FirestoreDB struct {
// contains filtered or unexported fields
}
firestoreB is a DB implementation backed by Firestore.
func NewDBWithParams ¶
func NewDBWithParams(ctx context.Context, project, namespace, instance string, ts oauth2.TokenSource) (*FirestoreDB, error)
NewDBWithParams returns a DB instance backed by Firestore, using the given params.
func (*FirestoreDB) Delete ¶
func (d *FirestoreDB) Delete(ctx context.Context, rollerID string) error
Delete implements DB.
Click to show internal directories.
Click to hide internal directories.