rdbms

package
v0.0.0-...-9f86afd Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPrepareStatement = "error when tying to prepare statement"
	ErrNotFound         = "there is no entry with provided arguments"
	ErrDuplicate        = "there is no entry with provided arguments"
	ErrorQueryRow       = "error when tying to read entry"
	ErrorQueryRows      = "error when tying to read entry"
	ErrExecute          = "error when tying to excute statement"
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Host     string `koanf:"host"`
	Port     int    `koanf:"port"`
	Username string `koanf:"username"`
	Password string `koanf:"password"`
	Database string `koanf:"database"`
}

type MigrateDirection

type MigrateDirection uint8
const (
	MigrateUp   MigrateDirection = 1
	MigrateDown MigrateDirection = 2
)

type RDBMS

type RDBMS interface {
	Migrate(source string, direction MigrateDirection) error

	// will be used for read and create
	QueryRow(query string, in []any, out []any) error

	Query(query string, in []any, out [][]any) error

	// will be used for update and delete
	Execute(query string, in []any) error
}

func NewMysql

func NewMysql(cfg *Config) (RDBMS, error)

func NewPostgres

func NewPostgres(cfg *Config) (RDBMS, error)

Jump to

Keyboard shortcuts

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