db

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseConnection

func CloseConnection(db DB) error

CloseConnection closes the db connection. If it's a test DB, it also DELETEs the DB.

func DestroyTestDB

func DestroyTestDB(db *gorm.DB) error

DestroyTestDB destroys a test database.

func GetTestDB

func GetTestDB() (*gorm.DB, error)

GetTestDB creates a test db.

func QueryStatement

func QueryStatement(db DB, tableName string, params *util.APIParams, apiToDBFieldMap map[string]string) (DB, DB, error)

QueryStatement creates a default query and count statement from APIParams.

Types

type DB

type DB = *gorm.DB

DB aliases the ORM package.

func GetConnection

func GetConnection() (DB, error)

GetConnection opens the DB via gorm. The returned handle is safe for concurrent and reuse.

Jump to

Keyboard shortcuts

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