database

package
v0.0.0-...-17c6d09 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Models = []interface{}{
	&models.Paste{},
	&models.APIKey{},
	&models.Shortlink{},
	&models.AnalyticsEvent{},
}

Models is a list of all models that need to be migrated

Functions

func DropAllTables

func DropAllTables(db *gorm.DB) error

func GetMigrator

func GetMigrator(db *gorm.DB) gorm.Migrator

func HasTable

func HasTable(db *gorm.DB, model interface{}) bool

func RunMigrations

func RunMigrations(db *gorm.DB) error

RunMigrations runs all necessary database migrations

Types

type Database

type Database struct {
	*gorm.DB
}

func New

func New(config *config.Config, gormConfig *gorm.Config) (*Database, error)

func (*Database) Close

func (d *Database) Close() error

func (*Database) Migrate

func (d *Database) Migrate(config *config.Config) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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