dbservice

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: GPL-3.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallRead

func CallRead(db *sql.DB, name string, args ...interface{}) ([]interface{}, messagehandle.ErrorMsg)

CallRead call stored procedure

func CallReadOutMap

func CallReadOutMap(db *sql.DB, name string, args ...interface{}) ([]map[string]interface{}, messagehandle.ErrorMsg)

CallReadOutMap call stored procedure

func CallReadOutMultipleMap

func CallReadOutMultipleMap(db *sql.DB, name string, args ...interface{}) ([][]map[string]interface{}, messagehandle.ErrorMsg)

CallReadOutMultipleMap call stored procedure

func CallWrite

func CallWrite(db *sql.DB, name string, args ...interface{}) (sql.Result, messagehandle.ErrorMsg)

CallWrite ...

func Exec

func Exec(db *sql.DB, query string, args ...interface{}) (sql.Result, messagehandle.ErrorMsg)

Exec Use to INSTER, UPDATE, DELETE

func MakeProcedureQueryStr

func MakeProcedureQueryStr(name string, args int) string

MakeProcedureQueryStr ...

func MakeScanArray

func MakeScanArray(rows *sql.Rows) []interface{}

MakeScanArray ...

func MakeScanMap

func MakeScanMap(rows *sql.Rows) []map[string]interface{}

MakeScanMap ...

func Query

func Query(db *sql.DB, query string, args ...interface{}) ([]interface{}, messagehandle.ErrorMsg)

Query Use to SELECT return array, first is Keys

func QueryMultipleResult

func QueryMultipleResult(db *sql.DB, query string, args ...interface{}) ([][]map[string]interface{}, messagehandle.ErrorMsg)

QueryMultipleResult ...

func QueryOutMap

func QueryOutMap(db *sql.DB, query string, args ...interface{}) ([]map[string]interface{}, messagehandle.ErrorMsg)

QueryOutMap Use to SELECT return array map

Types

type ConnSetting

type ConnSetting struct {
	DBUser, DBPassword, DBIP, DBPORT string
}

ConnSetting ...

type DB

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

DB ...

func (*DB) ConnectDB

func (db *DB) ConnectDB(dbName string, setting ConnSetting) error

ConnectDB ...

func (*DB) GetDB

func (db *DB) GetDB() *sql.DB

GetDB ...

func (*DB) SetSetting

func (db *DB) SetSetting(setting ConnSetting)

SetSetting ...

Jump to

Keyboard shortcuts

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