db

package
v0.0.0-...-003ff6d Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDBConnectionFailed = errors.New("connection to database failed")
	ErrUnknownDriver      = errors.New("database driver unknown")
)

Functions

This section is empty.

Types

type Connection

type Connection struct {
	*gorm.DB
	// contains filtered or unexported fields
}

Connection wrapper for gorm with own logging

func New

func New(driver Driver, dsn string, logger log.Logger) (*Connection, error)

New returns a Connection with a opened database connection with gorm

func (*Connection) Close

func (c *Connection) Close() error

Close closing the database connection

type Driver

type Driver string

Driver defined the used database

const (
	DriverMySQL Driver = "mysql"
)

func StringToDriver

func StringToDriver(driverString string) (Driver, error)

StringToDriver check if string contains valid driver name and returns as defined typ

Jump to

Keyboard shortcuts

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