database

package
v0.0.0-...-a5f9b48 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseConnection

func CloseConnection(db *gorm.DB) error

CloseConnection closes the database connection.

func GetDSN

func GetDSN(cfg Config) string

GetDSN returns a data source name string

func GetDatabaseURL

func GetDatabaseURL(cfg Config) string

func NewConnection

func NewConnection(cfg Config) (*gorm.DB, error)

NewConnection establishes a new database connection with the given config.

Types

type Config

type Config struct {
	Host     string `mapstructure:"host"`
	Port     uint   `mapstructure:"port"`
	Name     string `mapstructure:"name"`
	User     string `mapstructure:"user"`
	Password string `mapstructure:"password"`
}

Postgres connection config

Jump to

Keyboard shortcuts

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