1
0
mirror of https://github.com/fumiama/terasu-cloudflared.git synced 2026-06-08 20:10:25 +08:00

TUN-2243: Revert "STOR-519: Add db-connect, a SQL over HTTPS server"

This reverts commit 5da2109811.
This commit is contained in:
Adam Chalmers
2019-08-26 16:45:49 -05:00
parent c3c88cc31e
commit 4e1df1a211
410 changed files with 666 additions and 362649 deletions

56
vendor/github.com/elgs/gosqljson/README.md generated vendored Normal file
View File

@@ -0,0 +1,56 @@
gosqljson
=========
A Go SQL to JSON library.
#Installation
`go get -u github.com/elgs/gosqljson`
# Sample code
Data in the table:
```
ID NAME
0 Alicia
1 Brian
2 Chloe
4 Bianca
5 Leo
6 Joy
7 Sam
8 Elgs
```
```go
package main
import (
"database/sql"
"fmt"
"github.com/elgs/gosqljson"
_ "github.com/go-sql-driver/mysql"
)
func main() {
ds := "username:password@tcp(host:3306)/db"
db, err := sql.Open("mysql", ds)
if err != nil {
fmt.Println("sql.Open:", err)
return
}
theCase := "lower" // "lower", "upper", "camel" or the orignal case if this is anything other than these three
// headers []string, data [][]string, error
headers, data, _ := gosqljson.QueryDbToArray(db, theCase, "SELECT ID,NAME FROM t LIMIT ?,?", 0, 3)
fmt.Println(headers)
// ["id","name"]
fmt.Println(data)
// [["0","Alicia"],["1","Brian"],["2","Chloe"]]
// data []map[string]string, error
data, _ := gosqljson.QueryDbToMap(db, theCase, "SELECT ID,NAME FROM t LIMIT ?,?", 0, 3)
fmt.Println(data)
// [{"id":"0","name":"Alicia"},{"id":"1","name":"Brian"},{"id":"2","name":"Chloe"}]
}
```