database

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close the database connections if they exist.

func GetConnection

func GetConnection() *gorm.DB

GetConnection returns the global database connection pool. Creates a new connection pool if no connection is available.

The connections will be closed automatically on server shutdown so you don't need to call "Close()" when you're done with the database.

func Migrate

func Migrate()

Migrate migrates all registered models.

func RegisterModel

func RegisterModel(model interface{})

RegisterModel registers a model for auto-migration. When writing a model file, you should always register it in the init() function.

 func init() {
		database.RegisterModel(&MyModel{})
 }

Types

This section is empty.

Jump to

Keyboard shortcuts

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