diff options
author | mattn <mattn.jp@gmail.com> | 2013-09-12 16:50:41 +0900 |
---|---|---|
committer | mattn <mattn.jp@gmail.com> | 2013-09-12 16:50:41 +0900 |
commit | 1c9e7729fb8845088ed9e223581dd37bd8e502cc (patch) | |
tree | e7025592a96163a5454b216f4b479cd36f7a0817 /template/go/snip-db-query.go | |
parent | d1b69d9a9b9372ef56ae7ee91799e23f2ee9703b (diff) | |
download | vim-sonictemplate-1c9e7729fb8845088ed9e223581dd37bd8e502cc.tar.gz vim-sonictemplate-1c9e7729fb8845088ed9e223581dd37bd8e502cc.tar.bz2 vim-sonictemplate-1c9e7729fb8845088ed9e223581dd37bd8e502cc.zip |
Add templates that I use often
Diffstat (limited to 'template/go/snip-db-query.go')
-rw-r--r-- | template/go/snip-db-query.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/template/go/snip-db-query.go b/template/go/snip-db-query.go new file mode 100644 index 0000000..847dd79 --- /dev/null +++ b/template/go/snip-db-query.go @@ -0,0 +1,10 @@ +rows, err := db.Query("{{_cursor_}}") +if err != nil { + log.Fatal(err) +} +defer rows.Close() +for rows.Next() { + var value string + rows.Scan(&value) + fmt.Println(value) +} |