database

package
v1.0.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatabaseExists

func DatabaseExists(dbPath string) (bool, error)

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

func DatabaseWithDefaultSettings

func DatabaseWithDefaultSettings(path string, createDatabaseIfNotExists bool) (*gorm.DB, error)

Types

type Engine

type Engine string
const (
	EngineUnknown Engine = "unknown"
	EngineAuto    Engine = "auto"
	EngineSQLite  Engine = "sqlite"
)

func CheckDatabaseEngine

func CheckDatabaseEngine(dbPath string, createDatabaseIfNotExists bool, dbEngine ...Engine) (Engine, error)

CheckDatabaseEngine 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 DatabaseEngineAllowed

func DatabaseEngineAllowed(dbEngine Engine, allowedEngines ...Engine) (Engine, error)

DatabaseEngineAllowed checks if the database engine is allowed.

func DatabaseEngineFromString

func DatabaseEngineFromString(engineStr string) (Engine, error)

DatabaseEngineFromString parses an engine from a string. Returns an error if the engine is unknown.

func DatabaseEngineFromStringAllowed

func DatabaseEngineFromStringAllowed(dbEngineStr string, allowedEngines ...Engine) (Engine, error)

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

func LoadDatabaseEngineFromFile

func LoadDatabaseEngineFromFile(path string) (Engine, error)

LoadDatabaseEngineFromFile 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