[轉]區塊鍊 blockshain bitcoin ethereum
非常好的說明 Block
https://www.youtube.com/watch?v=_160oMzblY8
https://anders.com/blockchain/
https://www.inside.com.tw/2018/05/16/monero-hard-fork-success
[轉]Golang 交叉编译跨平台的可执行程序 (Mac、Linux、Windows )
https://www.jisec.com/application-development/753.html
go env
Mac 下编译 Linux 和 Windows 64位可执行程序
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go
Linux 下编译 Mac 和 Windows 64位可执行程序
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go
Windows 下编译 Mac 和 Linux 64位可执行程序
SET CGO_ENABLED=0
SET GOOS=darwin
SET GOARCH=amd64
go build main.go
SET CGO_ENABLED=0
SET GOOS=linux
SET GOARCH=amd64
go build main.go
OS ARCH OS version
linux 386 / amd64 / arm >= Linux 2.6
darwin 386 / amd64 OS X (Snow Leopard + Lion)
freebsd 386 / amd64 >= FreeBSD 7
windows 386 / amd64 >= Windows 2000
go env
Mac 下编译 Linux 和 Windows 64位可执行程序
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go
Linux 下编译 Mac 和 Windows 64位可执行程序
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go
Windows 下编译 Mac 和 Linux 64位可执行程序
SET CGO_ENABLED=0
SET GOOS=darwin
SET GOARCH=amd64
go build main.go
SET CGO_ENABLED=0
SET GOOS=linux
SET GOARCH=amd64
go build main.go
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 { }
results := []map[string]interface{}{}
for rows.Next() {
result := make(map[string]interface{})
err = rows.MapScan(result)
results = append(results, result)
}
return results
}
BUT results to json use c.JSON(http.StatusOK, results) get warning value
https://stackoverflow.com/questions/39391437/merge-two-or-more-mapstringinterface-types-into-one-in-golang
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 { }
results := []map[string]interface{}{}
for rows.Next() {
result := make(map[string]interface{})
err = rows.MapScan(result)
results = append(results, result)
}
return results
}
BUT results to json use c.JSON(http.StatusOK, results) get warning value
https://stackoverflow.com/questions/39391437/merge-two-or-more-mapstringinterface-types-into-one-in-golang
訂閱:
文章 (Atom)