db

package
v0.0.0-...-ac624b7 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrCheck

func ErrCheck(err error, extraInfo string)

ErrCheck is just shorthand for ErrCheckWithFields when you have no fields

func ErrCheckWithFields

func ErrCheckWithFields(err error, extraInfo string, fields log.Fields)

ErrCheckWithFields considers logs errors with fields

func FatalCheck

func FatalCheck(err error, extraInfo string)

FatalCheck is just shorthand for FatalCheckWithFields when you have no fields

func FatalCheckWithFields

func FatalCheckWithFields(err error, extraInfo string, fields log.Fields)

FatalCheckWithFields considers any non-nil err fatal, and kills the process with as much logging information as possible

func GetCurrentVersion

func GetCurrentVersion(d *sqlx.DB) int

GetCurrentVersion returns the current schema version as an integer, or nil with an error

func Migrate

func Migrate(d *sqlx.DB, migrationDir string, dryrun bool)

Migrate ensures the db supports migration, loads bootstrap info, and applies as many migrations as it can in order until there are no migrations left to run, or a migration produces an error.

func TruncateTable

func TruncateTable(d *sqlx.DB, tableName string)

TruncateTable nukes a table and anything keyed off it

Types

type OrderDirection

type OrderDirection int

OrderDirection is for use with SQL ORDER clause

const (
	// OrderAscending corresponds to SQL's ASCENDING directive
	OrderAscending OrderDirection = iota
	// OrderDescending corresponds to SQL's DESCENDING directive
	OrderDescending
)

func (OrderDirection) String

func (o OrderDirection) String() (out string)

String returns the SQL syntax for an OrderDirection

Jump to

Keyboard shortcuts

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