Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoDatabase = errors.New("no database found with the specified name") ErrDriverNotSupported = errors.New("database driver not supported") )
Global errors
Functions ¶
func ResetInMemoryDb ¶ added in v1.6.2
func ResetInMemoryDb()
ResetInMemoryDb is used to erase instance.
Types ¶
type DBAccess ¶
type DBAccess interface { New(config DBConfig) (*sqlx.DB, error) Get() (*sqlx.DB, error) Close() error CanLock() bool RandomFuncName() string }
DBAccess is the common interface for data access definitions
type DBConfig ¶
type DBConfig struct { DBName string Driver string Address string Username string Password string MaxOpenConnections int MaxIdleConnections int ConnectionLifetime time.Duration }
DBConfig holds the configuration required to initialize a data source
type Generic ¶
type Generic struct {
// contains filtered or unexported fields
}
Generic is the generic data access implementation for `DBAccess` interface. Drivers currently supported: - mysql - sqlite3
func (*Generic) Close ¶
Close should be called when the server ends the execution, so connection are gracefully released
func (*Generic) RandomFuncName ¶
RandomFuncName returns the driver's RANDOM name
type InMemoryDB ¶ added in v1.6.2
type InMemoryDB interface { Set(key string, value interface{}, expiration time.Duration) error Get(key string) ([]byte, error) }
InMemoryDB declares Set and Get operations for redis.
func BuildNewInMemoryConnection ¶ added in v1.6.2
func BuildNewInMemoryConnection(address string, password string) InMemoryDB
BuildNewInMemoryConnection returns an in-memory database connection
Click to show internal directories.
Click to hide internal directories.