driver

package
v0.0.0-...-88ae880 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDatabase

func NewDatabase(dsn string) (*sql.DB, error)

NewDatabase creates a new database connection using the provided DSN and returns a pointer to the sql.DB object. It returns an error if there is an issue with opening or pinging the database.

Types

type DB

type DB struct {
	SQL *sql.DB
}

DB holds the database connection pool

func ConnectSQL

func ConnectSQL(dsn string) (*DB, error)

ConnectSQL connects to a SQL database using the provided DSN and returns a pointer to a DB object and an error. The DB object contains a connection pool with the maximum number of open connections, maximum number of idle connections, and maximum lifetime of a connection set. If the connection to the database fails, it returns an error.

Jump to

Keyboard shortcuts

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