gosql

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: MIT Imports: 5 Imported by: 0

README

gosql

sql lib for go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchAll

func FetchAll(rows *sql.Rows, total int) ([]map[string]string, error)

func FetchRow

func FetchRow(rows *sql.Rows) (map[string]string, error)

func New

func New(config *Config) (db *sql.DB, err error)

Types

type Config

type Config struct {
	Host     string `json:"host,omitempty"`
	Port     string `json:"port,omitempty"`
	User     string `json:"user,omitempty"`
	Password string `json:"password,omitempty"`
	Name     string `json:"db_name,omitempty"`
	Charset  string `json:"charset,omitempty"`
}

func (*Config) GetConfigString

func (c *Config) GetConfigString() string

type Pool

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

func NewPool

func NewPool() *Pool

func (Pool) Close

func (p Pool) Close() error

func (*Pool) GetClient

func (p *Pool) GetClient(alias string) *sql.DB

func (*Pool) GetPoolList

func (p *Pool) GetPoolList() map[string]*sql.DB

func (Pool) New

func (p Pool) New(alias string, config *Config) error

func (*Pool) SetClient

func (p *Pool) SetClient(alias string, client *sql.DB) error

Jump to

Keyboard shortcuts

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