postgres

package
v0.0.0-...-bcfd2cf Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host    string
	Port    int
	SSLMode string
	Name    string
	User    string
	Pass    string
	Debug   bool
}

Config instance of Postgres configuration details

func Conf

func Conf() *Config

Conf defines needed field for connecting to Postgres instance

func (*Config) MigrationString

func (c *Config) MigrationString() string

MigrationString returns the connection string in url format for connecting to postgres

func (*Config) String

func (c *Config) String() string

String returns the connection string for connecting to postgres

type Pg

type Pg struct {
	*gorm.DB
}

Pg instance of Postgres db with configuration details

func NewPg

func NewPg(conf *Config) (*Pg, error)

NewPg returns a new instance of postgres db. The configuration need to be correct in order to enable postgres to be connected with Connect on receiver method

Jump to

Keyboard shortcuts

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