phpmysql

package module
v0.0.0-...-94130a6 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

README

phpmysql

目前正在学习go,边用边学,代码肯定问题多多,先一个包一个包的试下

这个包目的是像使用php那样使用go对mysql进行添查删改

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mysql

type Mysql struct {
	Host     string
	User     string
	Password string
	Database string
	Db       *sql.DB
}

func (*Mysql) Close

func (t *Mysql) Close()

func (*Mysql) Connect

func (t *Mysql) Connect()

func (*Mysql) GetList

func (t *Mysql) GetList(sql string, args ...interface{}) (results [](map[string]string), count int)

func (*Mysql) GetOne

func (t *Mysql) GetOne(sql string, args ...interface{}) (result map[string]string, has bool)

func (*Mysql) Insert

func (t *Mysql) Insert(tablename string, insertsql map[string]interface{}) int64

insertarr := make(map[string]interface{}, 0) insertarr["link_id"] = 9876543 re := G.Mysql.Insert("cstock_jilu", insertarr) fmt.Println(re)

func (*Mysql) Inserts

func (t *Mysql) Inserts(tablename string, insertsql []map[string]interface{}) int64

insertarrs := make([]map[string]interface{}, 0)

for i := 0; i < 100; i++ {
	item := make(map[string]interface{}, 0)
	item["link_id"] = 9876543 + i
	insertarrs = append(insertarrs, item)
}

re := G.Mysql.Inserts("cstock_jilu", insertarrs) fmt.Println(re)

func (*Mysql) Join

func (t *Mysql) Join(arr []string) string

func (*Mysql) Q

func (t *Mysql) Q(query string, args ...interface{}) (sql.Result, error)

func (*Mysql) Update

func (t *Mysql) Update(tablename string, setsql map[string]interface{}, wheresql map[string]interface{}) int64

updatearr := make(map[string]interface{}, 0) updatearr["newjine"] = 12 wherearr := make(map[string]interface{}, 0) wherearr["cjid"] = 99999 G.Mysql.Update("cstock_jilu", updatearr, wherearr)

Jump to

Keyboard shortcuts

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