sqlserver

package
v2.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecTxQuery

func ExecTxQuery(query string, tx *sql.Tx, args ...interface{}) (string, error)

ExecTxQuery - ExecTxQuery

func GetSQLServerConnection

func GetSQLServerConnection(hostName string) (*sql.DB, error)

GetSQLServerConnection returns connection by hostname

func InitConnection

func InitConnection(connectionDetails SQLServerConfig) (*sql.DB, error)

InitConnection - InitConnection

func InitUsingJSON

func InitUsingJSON(configs []SQLServerConfig)

InitUsingJSON initializes sqlserver Connections for give JSON data

func SelectTxQuery

func SelectTxQuery(query string, tx *sql.Tx, args ...interface{}) (*gjson.Result, error)

SelectTxQuery - SelectTxQuery

Types

type SQLServerConfig

type SQLServerConfig struct {
	HostName        string        `json:"hostName"`
	Server          string        `json:"server"`
	Port            int           `json:"port"`
	Username        string        `json:"username"`
	Password        string        `json:"password"`
	Database        string        `json:"database"`
	IsDefault       bool          `json:"isDefault"`
	MaxIdleConns    int           `json:"maxIdleConns" `
	MaxOpenConns    int           `json:"maxOpenConns"`
	ConnMaxLifetime time.Duration `json:"connMaxLifetime" `
	IsDisabled      bool          `json:"isDisabled" `
}

SQLServerConfig

type SQLServerDAO

type SQLServerDAO struct {
	HostName string
}

SQLServerDAO

func GetSQLServerDAO

func GetSQLServerDAO() *SQLServerDAO

GetSQLServerDAO returns SQLServer DAO instance with default host

func GetSQLServerDAOWithHost

func GetSQLServerDAOWithHost(hostName string) *SQLServerDAO

GetSQLServerDAOWithHost returns SQLServer DAO instance with provided host

func (*SQLServerDAO) ExecQuery

func (ss *SQLServerDAO) ExecQuery(query string, args ...interface{}) (string, error)

ExecQuery to execute query

func (*SQLServerDAO) SelectQuery

func (ss *SQLServerDAO) SelectQuery(query string, args ...interface{}) (*gjson.Result, error)

SelectQuery - SelectQuery

Jump to

Keyboard shortcuts

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