跳到主要內容

發表文章

目前顯示的是有「golang」標籤的文章

Goose - a database migration tool for Go 資料庫遷移工具

Goose Go 語言下,好用的資料庫遷移工具。特別是跟同事協同開發時,做好資料庫版本管理的好幫手。除了用 SQL 外,你也可以自己產生對映的 Go 程式。 Goose is a database migration tool. Manage your database schema by creating incremental SQL changes or Go functions. github repo. (程式庫連結) https://github.com/pressly/goose Install (安裝) $ go get -u github.com/pressly/goose/cmd/goose Usage (語法) kz@KZ ~/Blogger/bloggerfiles (master) $ goose Usage: goose [OPTIONS] DRIVER DBSTRING COMMAND Drivers: postgres mysql sqlite3 redshift Examples: goose sqlite3 ./foo.db status goose sqlite3 ./foo.db create init sql goose sqlite3 ./foo.db create add_some_column sql goose sqlite3 ./foo.db create fetch_user_data go goose sqlite3 ./foo.db up goose postgres "user=postgres dbname=postgres sslmode=disable" status goose mysql "user:password@/dbname" status goose redshift "postgres://user:password@qwerty.us-east-1.redshift.amazonaws.com:5439/db" status Options: -dir string dire...

Go language - strings.NewReader

最近在找 test 範例,常看到有的人用 strings.NewReader 有的用 bytes.NewBufferString 看文件說明 https://golang.org/pkg/strings/#NewReader NewReader returns a new Reader reading from s. It is similar to bytes.NewBufferString but more efficient and read-only.