From cc256c7b142955bed7bbe8d8709e3776b3b1b9a3 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Sun, 5 Mar 2017 00:43:17 +0900 Subject: [PATCH] add godoc for fixes golint --- sqlite3_test/sqltest.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/sqlite3_test/sqltest.go b/sqlite3_test/sqltest.go index e73e4ea..0ad9c3a 100644 --- a/sqlite3_test/sqltest.go +++ b/sqlite3_test/sqltest.go @@ -11,14 +11,17 @@ import ( "time" ) +// Dialect is a type of dialect of databases. type Dialect int +// Dialects for databases. const ( - SQLITE Dialect = iota - POSTGRESQL - MYSQL + SQLITE Dialect = iota // SQLITE mean SQLite3 dialect + POSTGRESQL // POSTGRESQL mean PostgreSQL dialect + MYSQL // MYSQL mean MySQL dialect ) +// DB provide context for the tests type DB struct { *testing.T *sql.DB @@ -149,6 +152,7 @@ func makeBench() { } } +// TestResult is test for result func TestResult(t *testing.T) { db.tearDown() db.mustExec("create temporary table test (id " + db.serialPK() + ", name varchar(10))") @@ -175,6 +179,7 @@ func TestResult(t *testing.T) { } } +// TestBlobs is test for blobs func TestBlobs(t *testing.T) { db.tearDown() var blob = []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} @@ -201,6 +206,7 @@ func TestBlobs(t *testing.T) { } } +// TestManyQueryRow is test for many query row func TestManyQueryRow(t *testing.T) { if testing.Short() { t.Log("skipping in short mode") @@ -218,6 +224,7 @@ func TestManyQueryRow(t *testing.T) { } } +// TestTxQuery is test for transactional query func TestTxQuery(t *testing.T) { db.tearDown() tx, err := db.Begin() @@ -256,6 +263,7 @@ func TestTxQuery(t *testing.T) { } } +// TestPreparedStmt is test for prepared statement func TestPreparedStmt(t *testing.T) { db.tearDown() db.mustExec("CREATE TABLE t (count INT)") @@ -301,6 +309,7 @@ func TestPreparedStmt(t *testing.T) { // test -bench but calling Benchmark() from a benchmark test // currently hangs go. +// BenchmarkExec is benchmark for exec func BenchmarkExec(b *testing.B) { for i := 0; i < b.N; i++ { if _, err := db.Exec("select 1"); err != nil { @@ -309,6 +318,7 @@ func BenchmarkExec(b *testing.B) { } } +// BenchmarkQuery is benchmark for query func BenchmarkQuery(b *testing.B) { for i := 0; i < b.N; i++ { var n sql.NullString @@ -322,6 +332,7 @@ func BenchmarkQuery(b *testing.B) { } } +// BenchmarkParams is benchmark for params func BenchmarkParams(b *testing.B) { for i := 0; i < b.N; i++ { var n sql.NullString @@ -335,6 +346,7 @@ func BenchmarkParams(b *testing.B) { } } +// BenchmarkStmt is benchmark for statement func BenchmarkStmt(b *testing.B) { st, err := db.Prepare("select ?, ?, ?, ?") if err != nil { @@ -354,6 +366,7 @@ func BenchmarkStmt(b *testing.B) { } } +// BenchmarkRows is benchmark for rows func BenchmarkRows(b *testing.B) { db.once.Do(makeBench) @@ -378,6 +391,7 @@ func BenchmarkRows(b *testing.B) { } } +// BenchmarkStmtRows is benchmark for statement rows func BenchmarkStmtRows(b *testing.B) { db.once.Do(makeBench)