database

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Models

func Models() []interface{}

list of models for migration

Types

type Database

type Database struct {
	DB  *gorm.DB
	Log zerolog.Logger
	Cfg *config.Config
}

setup database with gorm

func NewDatabase

func NewDatabase(cfg *config.Config, log zerolog.Logger) *Database

func (*Database) ConnectDatabase

func (_db *Database) ConnectDatabase()

connect database

func (*Database) MigrateModels

func (_db *Database) MigrateModels()

migrate models

func (*Database) SeedModels

func (_db *Database) SeedModels(seeder ...Seeder)

seed data

func (*Database) ShutdownDatabase

func (_db *Database) ShutdownDatabase()

shutdown database

type Seeder

type Seeder interface {
	Seed(*gorm.DB) error
	Count() (int, error)
}

Jump to

Keyboard shortcuts

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