From 3648fcf6a0d662a9aa7b71e10c3035fec5f58795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Nieto?= <jose.carlos@menteslibres.net> Date: Sun, 13 Dec 2015 08:54:11 -0600 Subject: [PATCH] Changing import paths to v2 format. --- db.go | 10 +++++----- db_test.go | 13 +++++++------ internal/adapter/nonexistent.go | 2 +- internal/debug/debug.go | 2 +- internal/sqladapter/collection.go | 4 ++-- internal/sqladapter/database.go | 10 +++++----- internal/sqlutil/result/result.go | 2 +- internal/sqlutil/tx/tx.go | 2 +- mongo/_example/main.go | 4 ++-- mongo/benchmark_test.go | 14 +++++++------- mongo/collection.go | 3 ++- mongo/connection.go | 2 +- mongo/connection_test.go | 2 +- mongo/database.go | 5 +++-- mongo/database_test.go | 2 +- mongo/result.go | 5 +++-- mysql/_example/main.go | 4 ++-- mysql/benchmark_test.go | 26 +++++++++++++------------- mysql/collection.go | 4 ++-- mysql/connection.go | 2 +- mysql/connection_test.go | 2 +- mysql/database.go | 6 +++--- mysql/database_test.go | 4 ++-- mysql/mysql.go | 4 ++-- postgresql/_example/main.go | 4 ++-- postgresql/benchmark_test.go | 26 +++++++++++++------------- postgresql/collection.go | 4 ++-- postgresql/connection.go | 2 +- postgresql/connection_test.go | 2 +- postgresql/database.go | 6 +++--- postgresql/database_test.go | 4 ++-- postgresql/postgresql.go | 4 ++-- ql/_example/main.go | 4 ++-- ql/benchmark_test.go | 26 +++++++++++++------------- ql/collection.go | 4 ++-- ql/database.go | 6 +++--- ql/database_test.go | 4 ++-- ql/ql.go | 4 ++-- sqlite/_example/main.go | 4 ++-- sqlite/benchmark_test.go | 26 +++++++++++++------------- sqlite/collection.go | 4 ++-- sqlite/database.go | 6 +++--- sqlite/database_test.go | 4 ++-- sqlite/sqlite.go | 4 ++-- wrapper.go | 2 +- 45 files changed, 144 insertions(+), 140 deletions(-) diff --git a/db.go b/db.go index f7f637f0..721c4d35 100644 --- a/db.go +++ b/db.go @@ -22,26 +22,26 @@ // Package db provides a single interface for interacting with different data // sources through the use of adapters that wrap well-known database drivers. // -// As of today, `upper.io/db` fully supports MySQL, PostgreSQL and SQLite (CRUD +// As of today, `upper.io/db.v2` fully supports MySQL, PostgreSQL and SQLite (CRUD // + Transactions) and provides partial support for MongoDB and QL (CRUD only). // // Usage: // // import( // // Main package. -// "upper.io/db" +// "upper.io/db.v2" // // PostgreSQL adapter. -// "upper.io/db/postgresql" +// "upper.io/db.v2/postgresql" // ) // -// `upper.io/db` is not an ORM and thus does not impose any hard restrictions +// `upper.io/db.v2` is not an ORM and thus does not impose any hard restrictions // on data structures: // // // This code works the same for all supported databases. // var people []Person // res = col.Find(db.Cond{"name": "Max"}).Limit(2).Sort("-input") // err = res.All(&people) -package db // import "upper.io/db" +package db // import "upper.io/db.v2" import ( "reflect" diff --git a/db_test.go b/db_test.go index b0e91cf7..4996887c 100644 --- a/db_test.go +++ b/db_test.go @@ -31,13 +31,14 @@ import ( "testing" "time" + "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" - "upper.io/db" - "upper.io/db/mongo" - "upper.io/db/mysql" - "upper.io/db/postgresql" - "upper.io/db/ql" - "upper.io/db/sqlite" + "upper.io/db.v2" + "upper.io/db.v2/mongo" + "upper.io/db.v2/mysql" + "upper.io/db.v2/postgresql" + "upper.io/db.v2/ql" + "upper.io/db.v2/sqlite" ) var wrappers = []string{ diff --git a/internal/adapter/nonexistent.go b/internal/adapter/nonexistent.go index 76fc989f..be4dc808 100644 --- a/internal/adapter/nonexistent.go +++ b/internal/adapter/nonexistent.go @@ -24,7 +24,7 @@ package adapter import ( "fmt" - "upper.io/db" + "upper.io/db.v2" ) var ( diff --git a/internal/debug/debug.go b/internal/debug/debug.go index 826bbcb5..5fb875cb 100644 --- a/internal/debug/debug.go +++ b/internal/debug/debug.go @@ -28,7 +28,7 @@ import ( "regexp" "strings" - "upper.io/db" + "upper.io/db.v2" ) var ( diff --git a/internal/sqladapter/collection.go b/internal/sqladapter/collection.go index 7dbd06cb..e18b7a15 100644 --- a/internal/sqladapter/collection.go +++ b/internal/sqladapter/collection.go @@ -1,8 +1,8 @@ package sqladapter import ( - "upper.io/db" - "upper.io/db/internal/sqlutil/result" + "upper.io/db.v2" + "upper.io/db.v2/internal/sqlutil/result" ) type Collection interface { diff --git a/internal/sqladapter/database.go b/internal/sqladapter/database.go index 7eac0ff3..600a10e4 100644 --- a/internal/sqladapter/database.go +++ b/internal/sqladapter/database.go @@ -9,11 +9,11 @@ import ( "upper.io/builder/sqlbuilder" "upper.io/builder/sqlgen" "upper.io/cache" - "upper.io/db" - "upper.io/db/internal/adapter" - "upper.io/db/internal/debug" - "upper.io/db/internal/schema" - "upper.io/db/internal/sqlutil/tx" + "upper.io/db.v2" + "upper.io/db.v2/internal/adapter" + "upper.io/db.v2/internal/debug" + "upper.io/db.v2/internal/schema" + "upper.io/db.v2/internal/sqlutil/tx" ) type HasExecStatement interface { diff --git a/internal/sqlutil/result/result.go b/internal/sqlutil/result/result.go index ba903016..732edf79 100644 --- a/internal/sqlutil/result/result.go +++ b/internal/sqlutil/result/result.go @@ -23,7 +23,7 @@ package result import ( "upper.io/builder" - "upper.io/db" + "upper.io/db.v2" ) type Result struct { diff --git a/internal/sqlutil/tx/tx.go b/internal/sqlutil/tx/tx.go index fa4728b5..0e2dd048 100644 --- a/internal/sqlutil/tx/tx.go +++ b/internal/sqlutil/tx/tx.go @@ -24,7 +24,7 @@ package sqltx import ( "database/sql" - "upper.io/db" + "upper.io/db.v2" ) type Database struct { diff --git a/mongo/_example/main.go b/mongo/_example/main.go index e5603dbd..96970ba5 100644 --- a/mongo/_example/main.go +++ b/mongo/_example/main.go @@ -6,8 +6,8 @@ import ( "os" "time" - "upper.io/db" // Imports the main db package. - _ "upper.io/db/mongo" // Imports the mongo adapter. + "upper.io/db.v2" // Imports the main db package. + _ "upper.io/db.v2/mongo" // Imports the mongo adapter. ) var settings = db.Settings{ diff --git a/mongo/benchmark_test.go b/mongo/benchmark_test.go index f2bc4967..16981931 100644 --- a/mongo/benchmark_test.go +++ b/mongo/benchmark_test.go @@ -7,7 +7,7 @@ import ( "gopkg.in/mgo.v2/bson" - "upper.io/db" + "upper.io/db.v2" ) const ( @@ -69,7 +69,7 @@ func BenchmarkMgoAppend(b *testing.B) { } } -// BenchmarkUpperAppend benchmarks an insertion by upper.io/db. +// BenchmarkUpperAppend benchmarks an insertion by upper.io/db.v2. func BenchmarkUpperAppend(b *testing.B) { sess, err := db.Open(Adapter, settings) @@ -98,7 +98,7 @@ func BenchmarkUpperAppend(b *testing.B) { } } -// BenchmarkUpperAppendVariableArgs benchmarks an insertion by upper.io/db +// BenchmarkUpperAppendVariableArgs benchmarks an insertion by upper.io/db.v2 // with variable parameters. func BenchmarkUpperAppendVariableArgs(b *testing.B) { @@ -181,7 +181,7 @@ func BenchmarkMgoSelectAll(b *testing.B) { } } -// BenchmarkUpperFind benchmarks upper.io/db's One method. +// BenchmarkUpperFind benchmarks upper.io/db.v2's One method. func BenchmarkUpperFind(b *testing.B) { var err error var sess db.Database @@ -212,7 +212,7 @@ func BenchmarkUpperFind(b *testing.B) { } } -// BenchmarkUpperFindWithC benchmarks upper.io/db's One method. +// BenchmarkUpperFindWithC benchmarks upper.io/db.v2's One method. func BenchmarkUpperFindWithC(b *testing.B) { var err error var sess db.Database @@ -238,7 +238,7 @@ func BenchmarkUpperFindWithC(b *testing.B) { } } -// BenchmarkUpperFindAll benchmarks upper.io/db's All method. +// BenchmarkUpperFindAll benchmarks upper.io/db.v2's All method. func BenchmarkUpperFindAll(b *testing.B) { var err error var sess db.Database @@ -297,7 +297,7 @@ func BenchmarkMgoUpdate(b *testing.B) { } } -// BenchmarkUpperUpdate benchmarks upper.io/db's Update method. +// BenchmarkUpperUpdate benchmarks upper.io/db.v2's Update method. func BenchmarkUpperUpdate(b *testing.B) { var err error var sess db.Database diff --git a/mongo/collection.go b/mongo/collection.go index 37f73957..ed835e6e 100644 --- a/mongo/collection.go +++ b/mongo/collection.go @@ -28,9 +28,10 @@ import ( "reflect" + "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" "upper.io/builder" - "upper.io/db" + "upper.io/db.v2" ) // Collection represents a mongodb collection. diff --git a/mongo/connection.go b/mongo/connection.go index c4f284e6..196de93a 100644 --- a/mongo/connection.go +++ b/mongo/connection.go @@ -26,7 +26,7 @@ import ( "net/url" "strings" - "upper.io/db" + "upper.io/db.v2" ) const connectionScheme = `mongodb` diff --git a/mongo/connection_test.go b/mongo/connection_test.go index 313e40af..f9a97ba7 100644 --- a/mongo/connection_test.go +++ b/mongo/connection_test.go @@ -24,7 +24,7 @@ package mongo import ( "testing" - "upper.io/db" + "upper.io/db.v2" ) func TestConnectionURL(t *testing.T) { diff --git a/mongo/database.go b/mongo/database.go index 8cd3a588..56bf44ef 100644 --- a/mongo/database.go +++ b/mongo/database.go @@ -19,7 +19,7 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -package mongo // import "upper.io/db/mongo" +package mongo // import "upper.io/db.v2/mongo" import ( "fmt" @@ -27,8 +27,9 @@ import ( "sync" "time" + "gopkg.in/mgo.v2" "upper.io/builder" - "upper.io/db" + "upper.io/db.v2" ) // Adapter holds the name of the mongodb adapter. diff --git a/mongo/database_test.go b/mongo/database_test.go index e22b3434..f95351ad 100644 --- a/mongo/database_test.go +++ b/mongo/database_test.go @@ -32,7 +32,7 @@ import ( "time" "gopkg.in/mgo.v2/bson" - "upper.io/db" + "upper.io/db.v2" ) // Wrapper settings. diff --git a/mongo/result.go b/mongo/result.go index 68f95795..7bcf21b1 100644 --- a/mongo/result.go +++ b/mongo/result.go @@ -29,9 +29,10 @@ import ( "encoding/json" + "gopkg.in/mgo.v2" "gopkg.in/mgo.v2/bson" - "upper.io/db" - "upper.io/db/internal/debug" + "upper.io/db.v2" + "upper.io/db.v2/internal/debug" ) // result represents a query result. diff --git a/mysql/_example/main.go b/mysql/_example/main.go index f84ee448..d5994359 100644 --- a/mysql/_example/main.go +++ b/mysql/_example/main.go @@ -6,8 +6,8 @@ import ( "os" "time" - "upper.io/db" // Imports the main db package. - "upper.io/db/mysql" // Improts the mysql adapter. + "upper.io/db.v2" // Imports the main db package. + "upper.io/db.v2/mysql" // Improts the mysql adapter. ) var settings = mysql.ConnectionURL{ diff --git a/mysql/benchmark_test.go b/mysql/benchmark_test.go index 56a35f3d..0aa29074 100644 --- a/mysql/benchmark_test.go +++ b/mysql/benchmark_test.go @@ -7,7 +7,7 @@ import ( "database/sql" - "upper.io/db" + "upper.io/db.v2" ) const ( @@ -73,7 +73,7 @@ func BenchmarkSQLAppend(b *testing.B) { // BenchmarkSQLAppendWithArgs benchmarks raw SQL queries with arguments but // without using prepared statements. The SQL query looks like the one that is -// generated by upper.io/db. +// generated by upper.io/db.v2. func BenchmarkSQLAppendWithArgs(b *testing.B) { var err error var sess db.Database @@ -135,7 +135,7 @@ func BenchmarkSQLPreparedAppend(b *testing.B) { // BenchmarkSQLAppendWithArgs benchmarks raw INSERT SQL queries with arguments // using prepared statements. The SQL query looks like the one that is -// generated by upper.io/db. +// generated by upper.io/db.v2. func BenchmarkSQLPreparedAppendWithArgs(b *testing.B) { var err error var sess db.Database @@ -172,7 +172,7 @@ func BenchmarkSQLPreparedAppendWithArgs(b *testing.B) { // BenchmarkSQLAppendWithVariableArgs benchmarks raw INSERT SQL queries with // arguments using prepared statements. The SQL query looks like the one that -// is generated by upper.io/db. +// is generated by upper.io/db.v2. func BenchmarkSQLPreparedAppendWithVariableArgs(b *testing.B) { var err error var sess db.Database @@ -208,7 +208,7 @@ func BenchmarkSQLPreparedAppendWithVariableArgs(b *testing.B) { // BenchmarkSQLPreparedAppendTransactionWithArgs benchmarks raw INSERT queries // within a transaction block with arguments and prepared statements. SQL -// queries look like those generated by upper.io/db. +// queries look like those generated by upper.io/db.v2. func BenchmarkSQLPreparedAppendTransactionWithArgs(b *testing.B) { var err error var sess db.Database @@ -251,7 +251,7 @@ func BenchmarkSQLPreparedAppendTransactionWithArgs(b *testing.B) { } } -// BenchmarkUpperAppend benchmarks an insertion by upper.io/db. +// BenchmarkUpperAppend benchmarks an insertion by upper.io/db.v2. func BenchmarkUpperAppend(b *testing.B) { sess, err := db.Open(Adapter, settings) @@ -280,7 +280,7 @@ func BenchmarkUpperAppend(b *testing.B) { } } -// BenchmarkUpperAppendVariableArgs benchmarks an insertion by upper.io/db +// BenchmarkUpperAppendVariableArgs benchmarks an insertion by upper.io/db.v2 // with variable parameters. func BenchmarkUpperAppendVariableArgs(b *testing.B) { @@ -309,7 +309,7 @@ func BenchmarkUpperAppendVariableArgs(b *testing.B) { } } -// BenchmarkUpperAppendTransaction benchmarks insertion queries by upper.io/db +// BenchmarkUpperAppendTransaction benchmarks insertion queries by upper.io/db.v2 // within a transaction operation. func BenchmarkUpperAppendTransaction(b *testing.B) { var sess db.Database @@ -353,7 +353,7 @@ func BenchmarkUpperAppendTransaction(b *testing.B) { } // BenchmarkUpperAppendTransactionWithMap benchmarks insertion queries by -// upper.io/db within a transaction operation using a map instead of a struct. +// upper.io/db.v2 within a transaction operation using a map instead of a struct. func BenchmarkUpperAppendTransactionWithMap(b *testing.B) { var sess db.Database var err error @@ -448,7 +448,7 @@ func BenchmarkSQLPreparedSelect(b *testing.B) { } } -// BenchmarkUpperFind benchmarks upper.io/db's One method. +// BenchmarkUpperFind benchmarks upper.io/db.v2's One method. func BenchmarkUpperFind(b *testing.B) { var err error var sess db.Database @@ -479,7 +479,7 @@ func BenchmarkUpperFind(b *testing.B) { } } -// BenchmarkUpperFindWithC benchmarks upper.io/db's One method. +// BenchmarkUpperFindWithC benchmarks upper.io/db.v2's One method. func BenchmarkUpperFindWithC(b *testing.B) { var err error var sess db.Database @@ -505,7 +505,7 @@ func BenchmarkUpperFindWithC(b *testing.B) { } } -// BenchmarkUpperFindAll benchmarks upper.io/db's All method. +// BenchmarkUpperFindAll benchmarks upper.io/db.v2's All method. func BenchmarkUpperFindAll(b *testing.B) { var err error var sess db.Database @@ -590,7 +590,7 @@ func BenchmarkSQLPreparedUpdate(b *testing.B) { } } -// BenchmarkUpperUpdate benchmarks upper.io/db's Update method. +// BenchmarkUpperUpdate benchmarks upper.io/db.v2's Update method. func BenchmarkUpperUpdate(b *testing.B) { var err error var sess db.Database diff --git a/mysql/collection.go b/mysql/collection.go index d0193b9d..4fab2b71 100644 --- a/mysql/collection.go +++ b/mysql/collection.go @@ -26,8 +26,8 @@ import ( "upper.io/builder/sqlbuilder" "upper.io/builder/sqlgen" - "upper.io/db" - "upper.io/db/internal/sqladapter" + "upper.io/db.v2" + "upper.io/db.v2/internal/sqladapter" ) type table struct { diff --git a/mysql/connection.go b/mysql/connection.go index 2e83a40d..00f79a8b 100644 --- a/mysql/connection.go +++ b/mysql/connection.go @@ -26,7 +26,7 @@ import ( "net/url" "strings" - "upper.io/db" + "upper.io/db.v2" ) const defaultPort = 3306 diff --git a/mysql/connection_test.go b/mysql/connection_test.go index d0b7cc44..126e0617 100644 --- a/mysql/connection_test.go +++ b/mysql/connection_test.go @@ -24,7 +24,7 @@ package mysql import ( "testing" - "upper.io/db" + "upper.io/db.v2" ) func TestConnectionURL(t *testing.T) { diff --git a/mysql/database.go b/mysql/database.go index c3510451..a16e9fc1 100644 --- a/mysql/database.go +++ b/mysql/database.go @@ -29,9 +29,9 @@ import ( _ "github.com/go-sql-driver/mysql" // MySQL driver. "upper.io/builder/sqlgen" template "upper.io/builder/template/mysql" - "upper.io/db" - "upper.io/db/internal/sqladapter" - "upper.io/db/internal/sqlutil/tx" + "upper.io/db.v2" + "upper.io/db.v2/internal/sqladapter" + "upper.io/db.v2/internal/sqlutil/tx" ) type database struct { diff --git a/mysql/database_test.go b/mysql/database_test.go index 1838fcdf..bea15617 100644 --- a/mysql/database_test.go +++ b/mysql/database_test.go @@ -34,7 +34,7 @@ import ( "testing" "time" - "upper.io/db" + "upper.io/db.v2" ) const ( @@ -1202,7 +1202,7 @@ func TestDataTypes(t *testing.T) { // TestExhaustConnections simulates a "too many connections" situation // triggered by opening more transactions than available connections. -// upper.io/db deals with this problem by waiting a bit more for the connection +// upper.io/db.v2 deals with this problem by waiting a bit more for the connection // to be established. func TestExhaustConnections(t *testing.T) { var err error diff --git a/mysql/mysql.go b/mysql/mysql.go index 2a247fd4..379b3676 100644 --- a/mysql/mysql.go +++ b/mysql/mysql.go @@ -19,10 +19,10 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -package mysql // import "upper.io/db/mysql" +package mysql // import "upper.io/db.v2/mysql" import ( - "upper.io/db" + "upper.io/db.v2" ) // Adapter is the public name of the adapter. diff --git a/postgresql/_example/main.go b/postgresql/_example/main.go index 4ff87cba..9c8685ba 100644 --- a/postgresql/_example/main.go +++ b/postgresql/_example/main.go @@ -6,8 +6,8 @@ import ( "os" "time" - "upper.io/db" // Imports the main db package. - "upper.io/db/postgresql" // Imports the postgresql adapter. + "upper.io/db.v2" // Imports the main db package. + "upper.io/db.v2/postgresql" // Imports the postgresql adapter. ) var settings = postgresql.ConnectionURL{ diff --git a/postgresql/benchmark_test.go b/postgresql/benchmark_test.go index 1ff3145d..67cf1888 100644 --- a/postgresql/benchmark_test.go +++ b/postgresql/benchmark_test.go @@ -7,7 +7,7 @@ import ( "database/sql" - "upper.io/db" + "upper.io/db.v2" ) const ( @@ -73,7 +73,7 @@ func BenchmarkSQLAppend(b *testing.B) { // BenchmarkSQLAppendWithArgs benchmarks raw SQL queries with arguments but // without using prepared statements. The SQL query looks like the one that is -// generated by upper.io/db. +// generated by upper.io/db.v2. func BenchmarkSQLAppendWithArgs(b *testing.B) { var err error var sess db.Database @@ -138,7 +138,7 @@ func BenchmarkSQLPreparedAppend(b *testing.B) { // BenchmarkSQLAppendWithArgs benchmarks raw INSERT SQL queries with arguments // using prepared statements. The SQL query looks like the one that is -// generated by upper.io/db. +// generated by upper.io/db.v2. func BenchmarkSQLPreparedAppendWithArgs(b *testing.B) { var err error var sess db.Database @@ -178,7 +178,7 @@ func BenchmarkSQLPreparedAppendWithArgs(b *testing.B) { // BenchmarkSQLAppendWithVariableArgs benchmarks raw INSERT SQL queries with // arguments using prepared statements. The SQL query looks like the one that -// is generated by upper.io/db. +// is generated by upper.io/db.v2. func BenchmarkSQLPreparedAppendWithVariableArgs(b *testing.B) { var err error var sess db.Database @@ -217,7 +217,7 @@ func BenchmarkSQLPreparedAppendWithVariableArgs(b *testing.B) { // BenchmarkSQLPreparedAppendTransactionWithArgs benchmarks raw INSERT queries // within a transaction block with arguments and prepared statements. SQL -// queries look like those generated by upper.io/db. +// queries look like those generated by upper.io/db.v2. func BenchmarkSQLPreparedAppendTransactionWithArgs(b *testing.B) { var err error var sess db.Database @@ -263,7 +263,7 @@ func BenchmarkSQLPreparedAppendTransactionWithArgs(b *testing.B) { } } -// BenchmarkUpperAppend benchmarks an insertion by upper.io/db. +// BenchmarkUpperAppend benchmarks an insertion by upper.io/db.v2. func BenchmarkUpperAppend(b *testing.B) { sess, err := db.Open(Adapter, settings) @@ -292,7 +292,7 @@ func BenchmarkUpperAppend(b *testing.B) { } } -// BenchmarkUpperAppendVariableArgs benchmarks an insertion by upper.io/db +// BenchmarkUpperAppendVariableArgs benchmarks an insertion by upper.io/db.v2 // with variable parameters. func BenchmarkUpperAppendVariableArgs(b *testing.B) { @@ -321,7 +321,7 @@ func BenchmarkUpperAppendVariableArgs(b *testing.B) { } } -// BenchmarkUpperAppendTransaction benchmarks insertion queries by upper.io/db +// BenchmarkUpperAppendTransaction benchmarks insertion queries by upper.io/db.v2 // within a transaction operation. func BenchmarkUpperAppendTransaction(b *testing.B) { var sess db.Database @@ -365,7 +365,7 @@ func BenchmarkUpperAppendTransaction(b *testing.B) { } // BenchmarkUpperAppendTransactionWithMap benchmarks insertion queries by -// upper.io/db within a transaction operation using a map instead of a struct. +// upper.io/db.v2 within a transaction operation using a map instead of a struct. func BenchmarkUpperAppendTransactionWithMap(b *testing.B) { var sess db.Database var err error @@ -460,7 +460,7 @@ func BenchmarkSQLPreparedSelect(b *testing.B) { } } -// BenchmarkUpperFind benchmarks upper.io/db's One method. +// BenchmarkUpperFind benchmarks upper.io/db.v2's One method. func BenchmarkUpperFind(b *testing.B) { var err error var sess db.Database @@ -491,7 +491,7 @@ func BenchmarkUpperFind(b *testing.B) { } } -// BenchmarkUpperFindWithC benchmarks upper.io/db's One method. +// BenchmarkUpperFindWithC benchmarks upper.io/db.v2's One method. func BenchmarkUpperFindWithC(b *testing.B) { var err error var sess db.Database @@ -517,7 +517,7 @@ func BenchmarkUpperFindWithC(b *testing.B) { } } -// BenchmarkUpperFindAll benchmarks upper.io/db's All method. +// BenchmarkUpperFindAll benchmarks upper.io/db.v2's All method. func BenchmarkUpperFindAll(b *testing.B) { var err error var sess db.Database @@ -602,7 +602,7 @@ func BenchmarkSQLPreparedUpdate(b *testing.B) { } } -// BenchmarkUpperUpdate benchmarks upper.io/db's Update method. +// BenchmarkUpperUpdate benchmarks upper.io/db.v2's Update method. func BenchmarkUpperUpdate(b *testing.B) { var err error var sess db.Database diff --git a/postgresql/collection.go b/postgresql/collection.go index 267f922f..0f8d3899 100644 --- a/postgresql/collection.go +++ b/postgresql/collection.go @@ -26,8 +26,8 @@ import ( "upper.io/builder/sqlbuilder" "upper.io/builder/sqlgen" - "upper.io/db" - "upper.io/db/internal/sqladapter" + "upper.io/db.v2" + "upper.io/db.v2/internal/sqladapter" ) type table struct { diff --git a/postgresql/connection.go b/postgresql/connection.go index a314d0e2..668b3fc1 100644 --- a/postgresql/connection.go +++ b/postgresql/connection.go @@ -28,7 +28,7 @@ import ( "unicode" "github.com/lib/pq" - "upper.io/db" + "upper.io/db.v2" ) // scanner implements a tokenizer for libpq-style option strings. diff --git a/postgresql/connection_test.go b/postgresql/connection_test.go index f2210c19..4a37bba6 100644 --- a/postgresql/connection_test.go +++ b/postgresql/connection_test.go @@ -24,7 +24,7 @@ package postgresql import ( "testing" - "upper.io/db" + "upper.io/db.v2" ) func TestConnectionURL(t *testing.T) { diff --git a/postgresql/database.go b/postgresql/database.go index 17b197d6..54e8f98e 100644 --- a/postgresql/database.go +++ b/postgresql/database.go @@ -30,9 +30,9 @@ import ( _ "github.com/lib/pq" // PostgreSQL driver. "upper.io/builder/sqlgen" template "upper.io/builder/template/postgresql" - "upper.io/db" - "upper.io/db/internal/sqladapter" - "upper.io/db/internal/sqlutil/tx" + "upper.io/db.v2" + "upper.io/db.v2/internal/sqladapter" + "upper.io/db.v2/internal/sqlutil/tx" ) type database struct { diff --git a/postgresql/database_test.go b/postgresql/database_test.go index 1abd78bc..0a541062 100644 --- a/postgresql/database_test.go +++ b/postgresql/database_test.go @@ -34,7 +34,7 @@ import ( "testing" "time" - "upper.io/db" + "upper.io/db.v2" ) const ( @@ -1677,7 +1677,7 @@ func TestOptionTypeJsonbStruct(t *testing.T) { // TestExhaustConnections simulates a "too many connections" situation // triggered by opening more transactions than available connections. -// upper.io/db deals with this problem by waiting a bit more for the connection +// upper.io/db.v2 deals with this problem by waiting a bit more for the connection // to be established. func TestExhaustConnections(t *testing.T) { var err error diff --git a/postgresql/postgresql.go b/postgresql/postgresql.go index 8ee55e65..23e77286 100644 --- a/postgresql/postgresql.go +++ b/postgresql/postgresql.go @@ -19,10 +19,10 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -package postgresql // import "upper.io/db/postgresql" +package postgresql // import "upper.io/db.v2/postgresql" import ( - "upper.io/db" + "upper.io/db.v2" ) // Adapter is the public name of the adapter. diff --git a/ql/_example/main.go b/ql/_example/main.go index a063c0e7..f29b26ad 100644 --- a/ql/_example/main.go +++ b/ql/_example/main.go @@ -6,8 +6,8 @@ import ( "os" "time" - "upper.io/db" // Imports the main db package. - "upper.io/db/ql" // Imports the ql adapter. + "upper.io/db.v2" // Imports the main db package. + "upper.io/db.v2/ql" // Imports the ql adapter. ) var settings = ql.ConnectionURL{ diff --git a/ql/benchmark_test.go b/ql/benchmark_test.go index 847d26f2..08072c2d 100644 --- a/ql/benchmark_test.go +++ b/ql/benchmark_test.go @@ -7,7 +7,7 @@ import ( "database/sql" - "upper.io/db" + "upper.io/db.v2" ) const ( @@ -100,7 +100,7 @@ func BenchmarkSQLAppend(b *testing.B) { // BenchmarkSQLAppendWithArgs benchmarks raw SQL queries with arguments but // without using prepared statements. The SQL query looks like the one that is -// generated by upper.io/db. +// generated by upper.io/db.v2. func BenchmarkSQLAppendWithArgs(b *testing.B) { var err error var sess db.Database @@ -189,7 +189,7 @@ func BenchmarkSQLPreparedAppend(b *testing.B) { // BenchmarkSQLAppendWithArgs benchmarks raw INSERT SQL queries with arguments // using prepared statements. The SQL query looks like the one that is -// generated by upper.io/db. +// generated by upper.io/db.v2. func BenchmarkSQLPreparedAppendWithArgs(b *testing.B) { var err error var sess db.Database @@ -238,7 +238,7 @@ func BenchmarkSQLPreparedAppendWithArgs(b *testing.B) { // BenchmarkSQLAppendWithVariableArgs benchmarks raw INSERT SQL queries with // arguments using prepared statements. The SQL query looks like the one that -// is generated by upper.io/db. +// is generated by upper.io/db.v2. func BenchmarkSQLPreparedAppendWithVariableArgs(b *testing.B) { var err error var sess db.Database @@ -286,7 +286,7 @@ func BenchmarkSQLPreparedAppendWithVariableArgs(b *testing.B) { // BenchmarkSQLPreparedAppendTransactionWithArgs benchmarks raw INSERT queries // within a transaction block with arguments and prepared statements. SQL -// queries look like those generated by upper.io/db. +// queries look like those generated by upper.io/db.v2. func BenchmarkSQLPreparedAppendTransactionWithArgs(b *testing.B) { var err error var sess db.Database @@ -329,7 +329,7 @@ func BenchmarkSQLPreparedAppendTransactionWithArgs(b *testing.B) { } } -// BenchmarkUpperAppend benchmarks an insertion by upper.io/db. +// BenchmarkUpperAppend benchmarks an insertion by upper.io/db.v2. func BenchmarkUpperAppend(b *testing.B) { sess, err := db.Open(Adapter, settings) @@ -358,7 +358,7 @@ func BenchmarkUpperAppend(b *testing.B) { } } -// BenchmarkUpperAppendVariableArgs benchmarks an insertion by upper.io/db +// BenchmarkUpperAppendVariableArgs benchmarks an insertion by upper.io/db.v2 // with variable parameters. func BenchmarkUpperAppendVariableArgs(b *testing.B) { @@ -387,7 +387,7 @@ func BenchmarkUpperAppendVariableArgs(b *testing.B) { } } -// BenchmarkUpperAppendTransaction benchmarks insertion queries by upper.io/db +// BenchmarkUpperAppendTransaction benchmarks insertion queries by upper.io/db.v2 // within a transaction operation. func BenchmarkUpperAppendTransaction(b *testing.B) { var sess db.Database @@ -431,7 +431,7 @@ func BenchmarkUpperAppendTransaction(b *testing.B) { } // BenchmarkUpperAppendTransactionWithMap benchmarks insertion queries by -// upper.io/db within a transaction operation using a map instead of a struct. +// upper.io/db.v2 within a transaction operation using a map instead of a struct. func BenchmarkUpperAppendTransactionWithMap(b *testing.B) { var sess db.Database var err error @@ -527,7 +527,7 @@ func BenchmarkSQLPreparedSelect(b *testing.B) { } } -// BenchmarkUpperFind benchmarks upper.io/db's One method. +// BenchmarkUpperFind benchmarks upper.io/db.v2's One method. func BenchmarkUpperFind(b *testing.B) { var err error var sess db.Database @@ -558,7 +558,7 @@ func BenchmarkUpperFind(b *testing.B) { } } -// BenchmarkUpperFindWithC benchmarks upper.io/db's One method. +// BenchmarkUpperFindWithC benchmarks upper.io/db.v2's One method. func BenchmarkUpperFindWithC(b *testing.B) { var err error var sess db.Database @@ -584,7 +584,7 @@ func BenchmarkUpperFindWithC(b *testing.B) { } } -// BenchmarkUpperFindAll benchmarks upper.io/db's All method. +// BenchmarkUpperFindAll benchmarks upper.io/db.v2's All method. func BenchmarkUpperFindAll(b *testing.B) { var err error var sess db.Database @@ -683,7 +683,7 @@ func BenchmarkSQLPreparedUpdate(b *testing.B) { } } -// BenchmarkUpperUpdate benchmarks upper.io/db's Update method. +// BenchmarkUpperUpdate benchmarks upper.io/db.v2's Update method. func BenchmarkUpperUpdate(b *testing.B) { var err error var sess db.Database diff --git a/ql/collection.go b/ql/collection.go index 60165e2b..5a7bd1ea 100644 --- a/ql/collection.go +++ b/ql/collection.go @@ -26,8 +26,8 @@ import ( "upper.io/builder/sqlbuilder" "upper.io/builder/sqlgen" - "upper.io/db" - "upper.io/db/internal/sqladapter" + "upper.io/db.v2" + "upper.io/db.v2/internal/sqladapter" ) type table struct { diff --git a/ql/database.go b/ql/database.go index c48e7c25..6c8e699f 100644 --- a/ql/database.go +++ b/ql/database.go @@ -30,9 +30,9 @@ import ( _ "github.com/cznic/ql/driver" // QL driver "upper.io/builder/sqlgen" template "upper.io/builder/template/ql" - "upper.io/db" - "upper.io/db/internal/sqladapter" - "upper.io/db/internal/sqlutil/tx" + "upper.io/db.v2" + "upper.io/db.v2/internal/sqladapter" + "upper.io/db.v2/internal/sqlutil/tx" ) type database struct { diff --git a/ql/database_test.go b/ql/database_test.go index 5a24547d..9d91a94a 100644 --- a/ql/database_test.go +++ b/ql/database_test.go @@ -37,7 +37,7 @@ import ( "database/sql" - "upper.io/db" + "upper.io/db.v2" ) const ( @@ -1020,7 +1020,7 @@ func TestDataTypes(t *testing.T) { // TestExhaustConnections simulates a "too many connections" situation // triggered by opening more transactions than available connections. -// upper.io/db deals with this problem by waiting a bit more for the connection +// upper.io/db.v2 deals with this problem by waiting a bit more for the connection // to be established. func TestExhaustConnections(t *testing.T) { var err error diff --git a/ql/ql.go b/ql/ql.go index 2fc8630e..b41a4c76 100644 --- a/ql/ql.go +++ b/ql/ql.go @@ -19,10 +19,10 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -package ql // import "upper.io/db/ql" +package ql // import "upper.io/db.v2/ql" import ( - "upper.io/db" + "upper.io/db.v2" ) // Adapter is the public name of the adapter. diff --git a/sqlite/_example/main.go b/sqlite/_example/main.go index ab99eea9..595a9662 100644 --- a/sqlite/_example/main.go +++ b/sqlite/_example/main.go @@ -5,8 +5,8 @@ import ( "log" "time" - "upper.io/db" // Imports the main db package. - "upper.io/db/sqlite" // Imports the sqlite adapter. + "upper.io/db.v2" // Imports the main db package. + "upper.io/db.v2/sqlite" // Imports the sqlite adapter. ) var settings = sqlite.ConnectionURL{ diff --git a/sqlite/benchmark_test.go b/sqlite/benchmark_test.go index 056b0180..0dfa8c9d 100644 --- a/sqlite/benchmark_test.go +++ b/sqlite/benchmark_test.go @@ -7,7 +7,7 @@ import ( "database/sql" - "upper.io/db" + "upper.io/db.v2" ) const ( @@ -73,7 +73,7 @@ func BenchmarkSQLAppend(b *testing.B) { // BenchmarkSQLAppendWithArgs benchmarks raw SQL queries with arguments but // without using prepared statements. The SQL query looks like the one that is -// generated by upper.io/db. +// generated by upper.io/db.v2. func BenchmarkSQLAppendWithArgs(b *testing.B) { var err error var sess db.Database @@ -135,7 +135,7 @@ func BenchmarkSQLPreparedAppend(b *testing.B) { // BenchmarkSQLAppendWithArgs benchmarks raw INSERT SQL queries with arguments // using prepared statements. The SQL query looks like the one that is -// generated by upper.io/db. +// generated by upper.io/db.v2. func BenchmarkSQLPreparedAppendWithArgs(b *testing.B) { var err error var sess db.Database @@ -172,7 +172,7 @@ func BenchmarkSQLPreparedAppendWithArgs(b *testing.B) { // BenchmarkSQLAppendWithVariableArgs benchmarks raw INSERT SQL queries with // arguments using prepared statements. The SQL query looks like the one that -// is generated by upper.io/db. +// is generated by upper.io/db.v2. func BenchmarkSQLPreparedAppendWithVariableArgs(b *testing.B) { var err error var sess db.Database @@ -208,7 +208,7 @@ func BenchmarkSQLPreparedAppendWithVariableArgs(b *testing.B) { // BenchmarkSQLPreparedAppendTransactionWithArgs benchmarks raw INSERT queries // within a transaction block with arguments and prepared statements. SQL -// queries look like those generated by upper.io/db. +// queries look like those generated by upper.io/db.v2. func BenchmarkSQLPreparedAppendTransactionWithArgs(b *testing.B) { var err error var sess db.Database @@ -251,7 +251,7 @@ func BenchmarkSQLPreparedAppendTransactionWithArgs(b *testing.B) { } } -// BenchmarkUpperAppend benchmarks an insertion by upper.io/db. +// BenchmarkUpperAppend benchmarks an insertion by upper.io/db.v2. func BenchmarkUpperAppend(b *testing.B) { sess, err := db.Open(Adapter, settings) @@ -280,7 +280,7 @@ func BenchmarkUpperAppend(b *testing.B) { } } -// BenchmarkUpperAppendVariableArgs benchmarks an insertion by upper.io/db +// BenchmarkUpperAppendVariableArgs benchmarks an insertion by upper.io/db.v2 // with variable parameters. func BenchmarkUpperAppendVariableArgs(b *testing.B) { @@ -309,7 +309,7 @@ func BenchmarkUpperAppendVariableArgs(b *testing.B) { } } -// BenchmarkUpperAppendTransaction benchmarks insertion queries by upper.io/db +// BenchmarkUpperAppendTransaction benchmarks insertion queries by upper.io/db.v2 // within a transaction operation. func BenchmarkUpperAppendTransaction(b *testing.B) { var sess db.Database @@ -353,7 +353,7 @@ func BenchmarkUpperAppendTransaction(b *testing.B) { } // BenchmarkUpperAppendTransactionWithMap benchmarks insertion queries by -// upper.io/db within a transaction operation using a map instead of a struct. +// upper.io/db.v2 within a transaction operation using a map instead of a struct. func BenchmarkUpperAppendTransactionWithMap(b *testing.B) { var sess db.Database var err error @@ -448,7 +448,7 @@ func BenchmarkSQLPreparedSelect(b *testing.B) { } } -// BenchmarkUpperFind benchmarks upper.io/db's One method. +// BenchmarkUpperFind benchmarks upper.io/db.v2's One method. func BenchmarkUpperFind(b *testing.B) { var err error var sess db.Database @@ -479,7 +479,7 @@ func BenchmarkUpperFind(b *testing.B) { } } -// BenchmarkUpperFindWithC benchmarks upper.io/db's One method. +// BenchmarkUpperFindWithC benchmarks upper.io/db.v2's One method. func BenchmarkUpperFindWithC(b *testing.B) { var err error var sess db.Database @@ -505,7 +505,7 @@ func BenchmarkUpperFindWithC(b *testing.B) { } } -// BenchmarkUpperFindAll benchmarks upper.io/db's All method. +// BenchmarkUpperFindAll benchmarks upper.io/db.v2's All method. func BenchmarkUpperFindAll(b *testing.B) { var err error var sess db.Database @@ -590,7 +590,7 @@ func BenchmarkSQLPreparedUpdate(b *testing.B) { } } -// BenchmarkUpperUpdate benchmarks upper.io/db's Update method. +// BenchmarkUpperUpdate benchmarks upper.io/db.v2's Update method. func BenchmarkUpperUpdate(b *testing.B) { var err error var sess db.Database diff --git a/sqlite/collection.go b/sqlite/collection.go index 3150cffc..e8a2ea00 100644 --- a/sqlite/collection.go +++ b/sqlite/collection.go @@ -26,8 +26,8 @@ import ( "upper.io/builder/sqlbuilder" "upper.io/builder/sqlgen" - "upper.io/db" - "upper.io/db/internal/sqladapter" + "upper.io/db.v2" + "upper.io/db.v2/internal/sqladapter" ) type table struct { diff --git a/sqlite/database.go b/sqlite/database.go index 7ad011b5..8f7b7226 100644 --- a/sqlite/database.go +++ b/sqlite/database.go @@ -32,9 +32,9 @@ import ( "upper.io/builder/sqlbuilder" "upper.io/builder/sqlgen" template "upper.io/builder/template/sqlite" - "upper.io/db" - "upper.io/db/internal/sqladapter" - "upper.io/db/internal/sqlutil/tx" + "upper.io/db.v2" + "upper.io/db.v2/internal/sqladapter" + "upper.io/db.v2/internal/sqlutil/tx" ) type database struct { diff --git a/sqlite/database_test.go b/sqlite/database_test.go index 20b65730..d2c21080 100644 --- a/sqlite/database_test.go +++ b/sqlite/database_test.go @@ -40,7 +40,7 @@ import ( "testing" "time" - "upper.io/db" + "upper.io/db.v2" ) const ( @@ -1172,7 +1172,7 @@ func TestDataTypes(t *testing.T) { // TestExhaustConnections simulates a "too many connections" situation // triggered by opening more transactions than available connections. -// upper.io/db deals with this problem by waiting a bit more for the connection +// upper.io/db.v2 deals with this problem by waiting a bit more for the connection // to be established. func TestExhaustConnections(t *testing.T) { var err error diff --git a/sqlite/sqlite.go b/sqlite/sqlite.go index cb153c0f..2a52824e 100644 --- a/sqlite/sqlite.go +++ b/sqlite/sqlite.go @@ -19,10 +19,10 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -package sqlite // import "upper.io/db/sqlite" +package sqlite // import "upper.io/db.v2/sqlite" import ( - "upper.io/db" + "upper.io/db.v2" ) // Adapter is the public name of the adapter. diff --git a/wrapper.go b/wrapper.go index 3e0a8658..febc0861 100644 --- a/wrapper.go +++ b/wrapper.go @@ -53,7 +53,7 @@ func Open(adapter string, conn ConnectionURL) (Database, error) { if ok == false { // Using panic instead of returning error because attemping to use an // adapter that does not exists will never result in success. - panic(fmt.Sprintf(`Open: Unknown adapter %s. (see: https://upper.io/db#database-adapters)`, adapter)) + panic(fmt.Sprintf(`Open: Unknown adapter %s. (see: https://upper.io/db.v2#database-adapters)`, adapter)) } // Creating a new connection everytime Open() is called. -- GitLab