database

package
v0.0.0-...-f83b169 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureEmpty

func EnsureEmpty(db *gorm.DB, dbType Type) error

EnsureEmpty checks if the database has no tables

func OpenDB

func OpenDB(cfg *Config) (*gorm.DB, error)

OpenDB opens a gorm database connection

func PossibleDBValues

func PossibleDBValues() []string

PossibleDBValues returns the list of possible values for DB key

Types

type Config

type Config struct {
	Type
	ConnStr string
}

Config contains all the necessary information to access the database

type Type

type Type uint16

Type is the database used to store the data

const (
	// DBTypeSQLite3 represent SQLite3 database
	DBTypeSQLite3 Type = iota + 1
	// DBTypeMySQL represent MySQL database
	DBTypeMySQL
)

func (*Type) Complete

func (d *Type) Complete(match string) []flags.Completion

Complete implements flags.Completer interface

func (Type) MarshalFlag

func (d Type) MarshalFlag() (string, error)

MarshalFlag implements flags.Marshaler interface

func (Type) String

func (d Type) String() string

String implements fmt.Stringer

func (*Type) UnmarshalFlag

func (d *Type) UnmarshalFlag(value string) error

UnmarshalFlag implements flags.Unmarshaler interface

Jump to

Keyboard shortcuts

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