database

package
v0.0.0-...-25e8c23 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateDatabaseError

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

CreateDatabaseError contains a reason as to why the database couldn't be created.

func (*CreateDatabaseError) Error

func (err *CreateDatabaseError) Error() string

type Database

type Database interface {
	// Set takes a key (string) and value (interface{}) and stores it in the database. If an error occurred this will be returned.
	// error is nil if all went well.
	Set(key string, value interface{}) error
	// Get takes a key (string) and returns a value (interface{}) and an error. Error is nil if everything went okay.
	Get(key string) (interface{}, error)
	// Delete takes a key (string) and deletes the value associated with that key. error is nil when all went well.
	Delete(key string) error
}

Database is an interface that defines the actions a database should be able to execute.

func Factory

func Factory(databaseName string, options ...func(*Database) error) (Database, error)

Factory is a factory function that creates a database based on the databaseName param. The databaseName must be "redis".

type DownError

type DownError struct{}

DownError indicates that the database is not reachable.

func (*DownError) Error

func (err *DownError) Error() string

type NotImplementedDatabaseError

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

NotImplementedDatabaseError is an error returned when this database mode does not exist. eg. Trying to use a MySQL database when no implementation is created for MySQL.

func (*NotImplementedDatabaseError) Error

func (err *NotImplementedDatabaseError) Error() string

type OperationError

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

OperationError indicates the operation could not be performed.

func (*OperationError) Error

func (err *OperationError) Error() string

Jump to

Keyboard shortcuts

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