sql

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver uint8

Driver represents a database driver

const (

	// SQLite ...
	SQLite Driver
	// Postgres ...
	Postgres
	// MySQL ...
	MySQL
)

func Open

func Open(cfg config.Config) (*sql.DB, Driver, error)

Open opens a connection to the db

func (Driver) String

func (d Driver) String() string

type Migrator

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator is responsible for migrating the database schema

func NewMigrator

func NewMigrator(cfg config.Config, logger *zap.Logger) (*Migrator, error)

NewMigrator creates a new Migrator

func (*Migrator) Close

func (m *Migrator) Close() (source, db error)

Close closes the source and db

func (*Migrator) Run

func (m *Migrator) Run(force bool) error

Run runs any pending migrations

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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