database

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(cfg *conf.DBConfiguration) (*Database, error)

func NewDatabaseWithConnection

func NewDatabaseWithConnection(db *sql.DB) Database

func (*Database) Close

func (db *Database) Close() error

func (*Database) Exec

func (db *Database) Exec(sql string, data ...interface{}) error

func (*Database) GetDatabase

func (db *Database) GetDatabase() *sql.DB

func (*Database) GetLastInsertId

func (db *Database) GetLastInsertId() uint64

func (*Database) GetOne

func (db *Database) GetOne(sql string, data ...interface{}) ([]byte, error)

func (*Database) GetRecord

func (db *Database) GetRecord(sqlString string, data ...interface{}) (map[string]interface{}, error)

func (*Database) GetRecords

func (db *Database) GetRecords(sqlString string, data ...interface{}) ([]map[string]interface{}, error)

func (*Database) GetResult

func (db *Database) GetResult() (sql.Result, error)

func (*Database) GetStmt

func (db *Database) GetStmt(sql string) (*sql.Stmt, error)

func (*Database) Insert

func (db *Database) Insert(tableName string, data map[string]interface{}) error

func (*Database) IsConnected

func (db *Database) IsConnected() bool

func (*Database) IsMySQL

func (db *Database) IsMySQL() bool

func (*Database) IsPostgres

func (db *Database) IsPostgres() bool

func (*Database) IsSQLite

func (db *Database) IsSQLite() bool

func (*Database) NewDB

func (db *Database) NewDB(cfg *conf.DBConfiguration) error

func (*Database) Update

func (db *Database) Update(tableName string, data map[string]interface{}) error

type IDatabase

type IDatabase interface {
	NewDB(*conf.DBConfiguration) error
	Exec(sql string, data ...interface{}) error
	GetOne(sql string, data ...interface{}) ([]byte, error)
	GetRecord(sql string, data ...interface{}) (map[string]interface{}, error)
	GetRecords(sql string, data ...interface{}) ([]map[string]interface{}, error)
	Insert(tableName string, data map[string]interface{}) error
	Update(tableName string, data map[string]interface{}) error
	IsConnected() bool
	IsSQLite() bool
	IsMySQL() bool
	IsPostgres() bool
	GetLastInsertId() uint64
	GetResult() (sql.Result, error)
	GetDatabase() *sql.DB
}

Jump to

Keyboard shortcuts

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