database

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package database provides the functionality to open, close and use a database

Index

Constants

This section is empty.

Variables

View Source
var Read *gorm.DB

Read Database connection for reading purposes

View Source
var Write *gorm.DB

Write Database connection for writing purposes

Functions

func AddModel

func AddModel(m interface{})

AddModel to the runtime

func Close

func Close()

Close connnection to database safely

func Open

func Open(c Config) (err error)

Open database and set the given configuration

Types

type Config

type Config struct {
	// type of the database, currently supports sqlite and postgres
	Type string
	// connection configuration
	Connection string
	// create another connection for reading only
	ReadConnection string
	// enable logging of the generated sql string
	Logging bool
}

Config of the database connection

Jump to

Keyboard shortcuts

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