dbutil

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDSN added in v0.13.0

func NewDSN(opts conf.DatabaseOpts) (dsn string, err error)

NewDSN takes given database options and returns parsed DSN.

func OpenDB added in v0.13.0

func OpenDB(opts conf.DatabaseOpts, cfg *gorm.Config) (*gorm.DB, error)

OpenDB opens a new database connection encapsulated as gorm.DB using given database options and GORM config.

func ParseMSSQLHostPort added in v0.13.0

func ParseMSSQLHostPort(info string) (host, port string)

ParseMSSQLHostPort parses given input in various forms for MSSQL and returns proper host and port number.

func ParsePostgreSQLHostPort added in v0.13.0

func ParsePostgreSQLHostPort(info string) (host, port string)

ParsePostgreSQLHostPort parses given input in various forms defined in https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING and returns proper host and port number.

func Quote added in v0.13.0

func Quote(format string, args ...string) string

Quote adds surrounding double quotes for all given arguments before being formatted if the current database is UsePostgreSQL.

Types

type Logger added in v0.12.4

type Logger struct {
	io.Writer
}

Logger is a wrapper of io.Writer for the GORM's logger.Writer.

func (*Logger) Printf added in v0.12.4

func (l *Logger) Printf(format string, args ...any)

Jump to

Keyboard shortcuts

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