database

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEntityColumns

func GetEntityColumns(entity interface{}) []interface{}

GetEntityColumns receives a POINTER on entity (NOT A VALUE), parses is using reflection and returns a slice of columns for database/sql Query() method purpose for retrieving data from result rows. https://stackoverflow.com/questions/56525471/how-to-use-rows-scan-of-gos-database-sql

Types

type CommonDBConnector

type CommonDBConnector struct {
	Connection *sql.DB
	Driver     string
	DSN        string
	Logger     *slog.Logger
}

func New

func New(dbConfig config.DatabaseConfig, logger *slog.Logger) (*CommonDBConnector, error)

func (*CommonDBConnector) CloseConnection

func (connector *CommonDBConnector) CloseConnection()

func (*CommonDBConnector) Connect

func (connector *CommonDBConnector) Connect() error

func (*CommonDBConnector) GetConnection

func (connector *CommonDBConnector) GetConnection() *sql.DB

func (*CommonDBConnector) GetTransaction

func (connector *CommonDBConnector) GetTransaction() (*sql.Tx, error)

Jump to

Keyboard shortcuts

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