db

package
v0.0.0-...-9385bab Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(config Config, opts ...gorm.Option) (db *gorm.DB, err error)

func MustConnect

func MustConnect(config Config, opts ...gorm.Option) *gorm.DB

Types

type Config

type Config struct {
	Driver string `json:"driver" yaml:"driver" env:"DB_DRIVER" default:"sqlite"`
	Host   string `json:"host" yaml:"host" env:"DB_HOST" default:""`
	Port   string `json:"port" yaml:"port" env:"DB_PORT" default:""`
	User   string `json:"user" yaml:"user" env:"DB_USER" default:""`
	Pass   string `json:"pass" yaml:"pass" env:"DB_PASS" default:""`
	Name   string `json:"name" yaml:"name" env:"DB_NAME" default:"./db.sqlite"`
}

func (*Config) DSN

func (c *Config) DSN() string

Jump to

Keyboard shortcuts

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