db

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateUUID

func GenerateUUID(db *gorm.DB)

Types

type Database

type Database interface {
	GetDB() *gorm.DB
}

func New

func New(driver Driver, models []interface{}) (database Database)

type Driver

type Driver int
const (
	Sqlite Driver = iota
	Postgres
)

type PostgresConfig

type PostgresConfig struct {
	Host     string `default:"localhost"`
	Port     int    `default:"5432"`
	Name     string `default:"development"`
	User     string `default:"postgres"`
	Pass     string `default:""`
	SSLMode  string `default:"disable"`
	TimeZone string `default:"America/Sao_Paulo"`
}

func NewPostgresConfig

func NewPostgresConfig() *PostgresConfig

func (*PostgresConfig) ToString

func (r *PostgresConfig) ToString() string

type PostgresDatabase

type PostgresDatabase struct {
	DB *gorm.DB
}

func NewPostgres

func NewPostgres(models []interface{}) *PostgresDatabase

func (*PostgresDatabase) GetDB

func (p *PostgresDatabase) GetDB() *gorm.DB

type SqliteConfig

type SqliteConfig struct {
	Path string `default:"db/development.db"`
}

func NewSqliteConfig

func NewSqliteConfig() *SqliteConfig

func (*SqliteConfig) ToString

func (sc *SqliteConfig) ToString() string

type SqliteDatabase

type SqliteDatabase struct {
	DB *gorm.DB
}

func NewSqlite

func NewSqlite(models []interface{}) *SqliteDatabase

func (*SqliteDatabase) GetDB

func (s *SqliteDatabase) GetDB() *gorm.DB

Jump to

Keyboard shortcuts

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