database

package
v0.1.1-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNil = errors.New("no matching record found in redis database")
	Ctx    = context.Background()
	Rdb    *redis.Client
)

Functions

func ConnectDatabase

func ConnectDatabase(cfg *entities.AppConfig) error

func Del

func Del(key string) error

func FindEntity

func FindEntity(id string, prefix string, entity interface{}) error

Function for finding an entity from database

func Get

func Get(key string) (string, error)

func GetAllValuesWithKeyPrefix

func GetAllValuesWithKeyPrefix(prefix string) (map[string]string, error)

func Set

func Set(key string, val interface{}) error

Types

type CreateDatabaseError

type CreateDatabaseError struct{}

CreateDatabaseError when cannot perform set on database

func (*CreateDatabaseError) Error

func (err *CreateDatabaseError) Error() string

type DownError

type DownError struct{}

DownError when its not a redis.Nil response, in this case the database is down

func (*DownError) Error

func (dbe *DownError) Error() string

type NotImplementedDatabaseError

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

NotImplementedDatabaseError when user tries to create a not implemented database

func (*NotImplementedDatabaseError) Error

func (err *NotImplementedDatabaseError) Error() string

type OperationError

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

OperationError when cannot perform a given operation on database (SET, GET, DELETE)

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