database

package
v0.0.0-...-930562d Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 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 *koanf.Koanf
}

setup database with gorm

func NewDatabase

func NewDatabase(cfg *koanf.Koanf, 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()

seed data

func (*Database) ShutdownDatabase

func (_db *Database) ShutdownDatabase()

shutdown database

type Seeder

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

func Seeders

func Seeders() []Seeder

list of models for migration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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