db

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: GPL-2.0 Imports: 6 Imported by: 3

README

db

database library in go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*gorm.DB
}

func NewDB

func NewDB(driver Driver, models ...interface{}) (*DB, error)

type Driver

type Driver interface {
	Connect() (*DB, error)
}

type Model

type Model gorm.Model

type Postgres

type Postgres struct {
	Host     string `validate:"required,hostname_port|tcp_addr"`
	User     string `validate:"required"`
	Pass     string `validate:"required"`
	DBName   string `validate:"required" mapstructure:"db-name"`
	SSL      string `validate:"required,oneof=disable allow prefer require verify-ca verify-full"`
	TimeZone string `validate:"omitempty" mapstructure:"time-zone"`
}

func (*Postgres) Connect

func (p *Postgres) Connect() (*DB, error)

Jump to

Keyboard shortcuts

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