summaryrefslogtreecommitdiff
path: root/src/database/sql/example_test.go
Commit message (Collapse)AuthorAgeFilesLines
* database/sql: fix incorrect function name in example_testVivian Liang2020-04-281-1/+1
| | | | | | | | | | fixes incorrect function name prefix in `example_test.go` Change-Id: I0cce8afc89f6ee6dab3e5152246d28deb597fe53 GitHub-Last-Rev: 4e9a6067c8307e049ace2e35414a838bf6c8a8a4 GitHub-Pull-Request: golang/go#38715 Reviewed-on: https://go-review.googlesource.com/c/go/+/230381 Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
* database/sql: fix variable name in exampleHarmen2020-03-181-1/+1
| | | | | | | | | | It's a very minor error, but it's a bad copy/paste example. Change-Id: Ia6a723c31f2205c933857ce2cf715bddf773ebb6 GitHub-Last-Rev: 7f14b1a5c1ea3775aa2009184b0b1790e03225eb GitHub-Pull-Request: golang/go#37932 Reviewed-on: https://go-review.googlesource.com/c/go/+/223960 Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
* database/sql: add example for DB.Prepare and Tx.PrepareHasan Ozgan2019-03-251-0/+57
| | | | | | | | Change-Id: Ib9272a7713ed7aaf8ad54c4827be8c095763e648 Reviewed-on: https://go-review.googlesource.com/c/go/+/161677 Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* database/sql: add examples for opening and testing a DB poolDaniel Theophanes2018-11-161-23/+54
| | | | | | | | | | | | | Show two larger application examples. One example that could be used in a CLI, the other in a long running service. These demonstarates different strategies for handling DB.Ping errors in context. Fixes #23738 Change-Id: Id01213caf1f47917239a7506b01d30e37db74d31 Reviewed-on: https://go-review.googlesource.com/c/101216 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* database/sql: add more examplesKevin Burke2018-03-251-7/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This aims to expand the coverage of examples showing how the sql package works, as well as to address a number of issues I've observed while explaining how the database package works: - The best way to issue UPDATE or INSERT queries, that don't need to scan anything in return. (Previously, we had no examples for any Execute statement). - How to use prepared statements and transactions. - How to aggregate arguments from a Query/QueryContext query into a slice. Furthermore just having examples in more places should help, as users click on e.g. the "Rows" return parameter and are treated with the lack of any example about how Rows is used. Switch package examples to use QueryContext/QueryRowContext; I think it is a good practice to prepare users to issue queries with a timeout attached, even if they are not using it immediately. Change-Id: I4e63af91c7e4fff88b25f820906104ecefde4cc3 Reviewed-on: https://go-review.googlesource.com/91015 Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Run-TryBot: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* all: minor vet fixesJosh Bleecher Snyder2016-10-241-1/+1
| | | | | | | | Change-Id: I22f0f3e792052762499f632571155768b4052bc9 Reviewed-on: https://go-review.googlesource.com/31759 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* database/sql: add support for multiple result setsDaniel Theophanes2016-10-151-0/+62
| | | | | | | | | | | | | | | Many database systems allow returning multiple result sets in a single query. This can be useful when dealing with many intermediate results on the server and there is a need to return more then one arity of data to the client. Fixes #12382 Change-Id: I480a9ac6dadfc8743e0ba8b6d868ccf8442a9ca1 Reviewed-on: https://go-review.googlesource.com/30592 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+46
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.