golang []map[string]interface{} sqlx BUT

Golang often us []interface{} or map[string]interface{} sqlx.Queryx Alternate Scan Types rows, err := db.Queryx(“SELECT * FROM place”) for rows.Next() { // cols is an []interface{} of all of the column results cols, err := rows.SliceScan() } rows, err := db.Queryx(“SELECT * FROM place”) for rows.Next() { results := make(map[string]interface{}) err = rows.MapScan(results) } So func Sqlselectall(db1 *sqlx.DB, table string) []map[string]interface{} { rows, err := db1.Queryx(“SELECT * FROM " + table) if err != nil { } ...

2018-05-15 · 1 min · 107 words · Me

windows docker go

1、go mkdir directory aaa create file go_httpserver.go package main import ( “fmt” “net/http” ) func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, “Welcome to my Website!!!\n %s”, r.URL.Path[1:]) } func main() { http.HandleFunc("/", handler) http.ListenAndServe(“0.0.0.0:80”, nil) } set GOARCH=amd64 set GOOS=linux go build go_httpserver.go => get linux go program 2、create docker image 2.1 install docker toolbox Link 2.2 run kitematic then see left-down DOCKER CLI , click it, then 2.2.1 create directory bbb 2.2.2 create Dockerfile ...

2017-12-13 · 1 min · 143 words · Me

go gae telegram bot telegrambot

https://blog.sean.taipei/2017/05/telegram-bot https://github.com/cortinico/telebotgae Use this token to access the HTTP API: 445067055:AAG8Lz1EL——————————— .https://api.telegram.org/bot/ https://api.telegram.org/bot445067055:445067055:AAG8Lz1EL---------------------------------/getMe https://api.telegram.org/bot445067055:445067055:AAG8Lz1EL---------------------------------/getUpdates .https://api.telegram.org/bot/sendMessage?chat_id=<Chat_id>&text= chat_id 使用者送訊息給telegram bot後,去getUpdates,就會有chat id https://api.telegram.org/bot445067055:AAG8Lz1EL---------------------------------/sendMessage?chat_id=265———-&text=Hello+World .https://api.telegram.org/bot/setWebhook?url= 刪除是用 deleteWebhook 取得Webhook資料 getWebhookInfo https://api.telegram.org/bot[API_KEY]/setWebhook?url=https://[PROJECT-ID].appspot.com https://api.telegram.org/bot445067055:AAG8Lz1EL---------------------------------/setWebhook?url=https://xxx---bot-17------.appspot.com

2017-08-31 · 1 min · 27 words · Me

go gae mux static html css js images

1、裝官方gcloud工具 2、裝python 2.7 3、到官方工具目錄 ……….\Local\Google\Cloud SDK\google-cloud-sdk 3-1、設定path //執行 install.bat 會有說明 source 在原本開發go的目錄執行下面指令及可,但要特別注意 出現套件未安裝的話 go get github.com/xxxx 裝一裝就行了 dev_appserver.py app.yaml //這裡要特注意,因為是local測試,會出錯!因為init()問題,如果是用flexible就不會,但又要改app.yaml gcloud app deploy gcloud app browse ====== gcloud init //reset project id 注意:gae flexible environment vs standard environment https://cloud.google.com/appengine/docs/the-appengine-environments 所以要用 standard environment ==================== https://www.slideshare.net/takuyaueda967/gaegoweb

2017-08-18 · 1 min · 44 words · Me

[轉]Easy Middleware in Go

https://dev.to/kevburnsjr/easy-middleware-in-go

2017-07-29 · 1 min · word · Me