db

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DriverSQLServer = "mssql"
	DriverMySQL     = "mysql"
)

Defines all possible sql drivers

Variables

This section is empty.

Functions

func DriverName

func DriverName() string

DriverName - Returns driver name

func InitConnection

func InitConnection(drvName string, connection string)

InitConnection - Inizializza la connessione impostando il driver e la stringa di connessione

func Query

func Query(query string, args ...interface{}) (*sqlx.Rows, error)

Query - Esegue fisicamente la query e restituisce l'istanza di *Rows

func QueryOrPanic

func QueryOrPanic(query string, args ...interface{}) *sqlx.Rows

QueryOrPanic - Esegue fisicamente la query e restituisce l'istanza di *Rows, panic in caso di errore

func TableExists

func TableExists(tableName string) bool

TableExists - Restituisce true se la tabella esiste altrimenti false

Types

type SQLConnector

type SQLConnector interface {
	DriverName() string
	Exec(string, ...interface{}) (sql.Result, error)
	Prepare(string) (*sql.Stmt, error)
	Preparex(string) (*sqlx.Stmt, error)
	Query(string, ...interface{}) (*sql.Rows, error)
	Queryx(string, ...interface{}) (*sqlx.Rows, error)
	QueryRow(string, ...interface{}) *sql.Row
	QueryRowx(string, ...interface{}) *sqlx.Row
}

SQLConnector - Interfaccia per gestire operazioni sotto transaction

func GetConnection

func GetConnection() SQLConnector

GetConnection - restituisce un'istanza di connessione al database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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