database

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: Apache-2.0, BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEngineMismatch = errors.New("database engine mismatch")
)

Functions

func Exists

func Exists(dbPath string) (bool, error)

Exists checks if the database folder exists and is not empty.

Types

type Engine

type Engine string
const (
	EngineUnknown Engine = "unknown"
	EngineAuto    Engine = "auto"
	EngineBadger  Engine = "badger"
	EngineDebug   Engine = "debug"
	EngineMapDB   Engine = "mapdb"
	EnginePebble  Engine = "pebble"
	EngineRocksDB Engine = "rocksdb"
)

func CheckEngine

func CheckEngine(dbPath string, createDatabaseIfNotExists bool, dbEngine Engine, allowedEngines []Engine) (Engine, error)

CheckEngine checks if the correct database engine is used. This function stores a so called "database info file" in the database folder or checks if an existing "database info file" contains the correct engine. Otherwise the files in the database folder are not compatible.

func EngineAllowed

func EngineAllowed(dbEngine Engine, allowedEngines []Engine) (Engine, error)

EngineAllowed checks if the database engine is allowed.

func EngineFromStringAllowed

func EngineFromStringAllowed(dbEngineStr string, allowedEngines []Engine) (Engine, error)

EngineFromStringAllowed parses an engine from a string and checks if the database engine is allowed.

func LoadEngineFromFile

func LoadEngineFromFile(path string, allowedEngines []Engine) (Engine, error)

LoadEngineFromFile returns the engine from the "database info file".

Jump to

Keyboard shortcuts

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