database

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dialector

func Dialector(opts *Options) gorm.Dialector

Types

type DBType

type DBType string
const (
	PostgreSQL DBType = "postgresql"
	MySQL      DBType = "mysql"
	SQLite     DBType = "sqlite"
)

type Database

type Database struct {
	*gorm.DB
}

func New

func New(opts *Options) (*Database, error)

type Options

type Options struct {
	Type     DBType `mapstructrue:"type"`
	Host     string `mapstructrue:"host"`
	Port     int    `mapstructrue:"port"`
	User     string `mapstructrue:"user"`
	Password string `mapstructrue:"password"`
	DbName   string `mapstructrue:"dbname"`
	Extra    string `mapstructrue:"extra"`
}

func (*Options) Dsn

func (opts *Options) Dsn() (dsn string)

Jump to

Keyboard shortcuts

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