From 41154ea9aee4c925cd20b91c9c9f1f8418932713 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 27 Oct 2023 15:32:38 +0800 Subject: [PATCH] start v2 --- caches/cache.go | 2 +- caches/lru_test.go | 4 +-- convert/time.go | 2 +- core/db.go | 20 +++++-------- core/db_test.go | 8 +++-- core/stmt.go | 2 +- core/tx.go | 6 ++-- dialects/dameng.go | 8 ++--- dialects/dialect.go | 4 +-- dialects/driver.go | 6 ++-- dialects/mssql.go | 4 +-- dialects/mysql.go | 4 +-- dialects/oracle.go | 4 +-- dialects/postgres.go | 4 +-- dialects/sqlite3.go | 4 +-- dialects/table_name.go | 6 ++-- dialects/table_name_test.go | 2 +- dialects/time.go | 2 +- dialects/time_test.go | 2 +- engine.go | 18 +++++------ engine_group.go | 10 +++---- go.mod | 43 +++++++++++++++++++++++++-- go.sum | 4 +-- interface.go | 12 ++++---- internal/statements/cache.go | 4 +-- internal/statements/column_map.go | 2 +- internal/statements/cond.go | 2 +- internal/statements/delete.go | 4 +-- internal/statements/expr.go | 4 +-- internal/statements/insert.go | 4 +-- internal/statements/join.go | 6 ++-- internal/statements/pagination.go | 2 +- internal/statements/pk.go | 4 +-- internal/statements/query.go | 2 +- internal/statements/select.go | 2 +- internal/statements/statement.go | 14 ++++----- internal/statements/statement_args.go | 2 +- internal/statements/statement_test.go | 10 +++---- internal/statements/table_name.go | 2 +- internal/statements/update.go | 10 +++---- internal/statements/values.go | 8 ++--- log/logger_context.go | 6 ++-- rows.go | 2 +- scan.go | 8 ++--- schemas/pk.go | 2 +- session.go | 15 +++++----- session_cols.go | 2 +- session_delete.go | 4 +-- session_find.go | 10 +++---- session_get.go | 24 +++++++-------- session_insert.go | 8 ++--- session_iterate.go | 10 +++---- session_raw.go | 2 +- session_schema.go | 4 +-- session_update.go | 6 ++-- sync.go | 4 +-- tags/parser.go | 10 +++---- tags/parser_test.go | 8 ++--- tags/tag.go | 2 +- tests/cache_test.go | 2 +- tests/engine_dm_test.go | 2 +- tests/engine_group_test.go | 4 +-- tests/engine_test.go | 2 +- tests/schema_test.go | 3 +- tests/session_cols_test.go | 2 +- tests/session_delete_test.go | 4 +-- tests/session_find_test.go | 6 ++-- tests/session_get_test.go | 8 ++--- tests/session_insert_test.go | 2 +- tests/session_pk_test.go | 2 +- tests/session_query_test.go | 4 +-- tests/session_raw_test.go | 2 +- tests/session_tx_test.go | 4 +-- tests/session_update_test.go | 8 ++--- tests/tags_test.go | 6 ++-- tests/tests.go | 10 +++---- tests/time_test.go | 4 +-- tests/types_test.go | 6 ++-- 78 files changed, 248 insertions(+), 223 deletions(-) diff --git a/caches/cache.go b/caches/cache.go index 7b80eb88..9a769450 100644 --- a/caches/cache.go +++ b/caches/cache.go @@ -12,7 +12,7 @@ import ( "strings" "time" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) const ( diff --git a/caches/lru_test.go b/caches/lru_test.go index 771b924c..beb3bb7b 100644 --- a/caches/lru_test.go +++ b/caches/lru_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) func TestLRUCache(t *testing.T) { @@ -40,7 +40,7 @@ func TestLRUCache(t *testing.T) { obj2 := cacher.GetBean(tableName, sid) assert.Nil(t, obj2) - var obj = new(CacheObject1) + obj := new(CacheObject1) cacher.PutBean(tableName, sid, obj) obj3 := cacher.GetBean(tableName, sid) assert.EqualValues(t, obj, obj3) diff --git a/convert/time.go b/convert/time.go index c923e955..50c6619d 100644 --- a/convert/time.go +++ b/convert/time.go @@ -11,7 +11,7 @@ import ( "strings" "time" - "xorm.io/xorm/internal/utils" + "xorm.io/xorm/v2/internal/utils" ) // String2Time converts a string to time with original location diff --git a/core/db.go b/core/db.go index b476ef9a..4d4e8399 100644 --- a/core/db.go +++ b/core/db.go @@ -13,15 +13,13 @@ import ( "regexp" "sync" - "xorm.io/xorm/contexts" - "xorm.io/xorm/log" - "xorm.io/xorm/names" + "xorm.io/xorm/v2/contexts" + "xorm.io/xorm/v2/log" + "xorm.io/xorm/v2/names" ) -var ( - // DefaultCacheSize sets the default cache size - DefaultCacheSize = 200 -) +// DefaultCacheSize sets the default cache size +var DefaultCacheSize = 200 // MapToSlice map query and struct as sql and args func MapToSlice(query string, mp interface{}) (string, []interface{}, error) { @@ -79,9 +77,7 @@ type cacheStruct struct { idx int } -var ( - _ QueryExecuter = &DB{} -) +var _ QueryExecuter = &DB{} // DB is a wrap of sql.DB with extra contents type DB struct { @@ -234,9 +230,7 @@ func (db *DB) QueryRowStruct(query string, st interface{}) *Row { return db.QueryRowStructContext(context.Background(), query, st) } -var ( - re = regexp.MustCompile(`[?](\w+)`) -) +var re = regexp.MustCompile(`[?](\w+)`) // ExecMapContext exec map with context.ContextHook // insert into (name) values (?) diff --git a/core/db_test.go b/core/db_test.go index a9c19392..9f622f4e 100644 --- a/core/db_test.go +++ b/core/db_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "xorm.io/xorm/names" + "xorm.io/xorm/v2/names" _ "github.com/go-sql-driver/mysql" _ "github.com/mattn/go-sqlite3" @@ -625,7 +625,8 @@ func TestExecStruct(t *testing.T) { t.Error(err) } - user := User{Name: "xlw", + user := User{ + Name: "xlw", Title: "tester", Age: 1.2, Alias: "lunny", @@ -670,7 +671,8 @@ func BenchmarkExecStruct(b *testing.B) { b.StartTimer() - user := User{Name: "xlw", + user := User{ + Name: "xlw", Title: "tester", Age: 1.2, Alias: "lunny", diff --git a/core/stmt.go b/core/stmt.go index 3247efed..8f7395d5 100644 --- a/core/stmt.go +++ b/core/stmt.go @@ -10,7 +10,7 @@ import ( "errors" "reflect" - "xorm.io/xorm/contexts" + "xorm.io/xorm/v2/contexts" ) // Stmt reprents a stmt objects diff --git a/core/tx.go b/core/tx.go index a2f745f8..85c165fb 100644 --- a/core/tx.go +++ b/core/tx.go @@ -8,12 +8,10 @@ import ( "context" "database/sql" - "xorm.io/xorm/contexts" + "xorm.io/xorm/v2/contexts" ) -var ( - _ QueryExecuter = &Tx{} -) +var _ QueryExecuter = &Tx{} // Tx represents a transaction type Tx struct { diff --git a/dialects/dameng.go b/dialects/dameng.go index 23d1836a..0c4a2d06 100644 --- a/dialects/dameng.go +++ b/dialects/dameng.go @@ -13,10 +13,10 @@ import ( "strconv" "strings" - "xorm.io/xorm/convert" - "xorm.io/xorm/core" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/convert" + "xorm.io/xorm/v2/core" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/schemas" ) func init() { diff --git a/dialects/dialect.go b/dialects/dialect.go index 8e512c4f..c34c4c96 100644 --- a/dialects/dialect.go +++ b/dialects/dialect.go @@ -10,8 +10,8 @@ import ( "strings" "time" - "xorm.io/xorm/core" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/core" + "xorm.io/xorm/v2/schemas" ) // URI represents an uri to visit database diff --git a/dialects/driver.go b/dialects/driver.go index c63dbfa3..bafea61e 100644 --- a/dialects/driver.go +++ b/dialects/driver.go @@ -9,7 +9,7 @@ import ( "fmt" "time" - "xorm.io/xorm/core" + "xorm.io/xorm/v2/core" ) // ScanContext represents a context when Scan @@ -31,9 +31,7 @@ type Driver interface { Scan(*ScanContext, *core.Rows, []*sql.ColumnType, ...interface{}) error } -var ( - drivers = map[string]Driver{} -) +var drivers = map[string]Driver{} // RegisterDriver register a driver func RegisterDriver(driverName string, driver Driver) { diff --git a/dialects/mssql.go b/dialects/mssql.go index aaa40335..71b7c1e8 100644 --- a/dialects/mssql.go +++ b/dialects/mssql.go @@ -13,8 +13,8 @@ import ( "strconv" "strings" - "xorm.io/xorm/core" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/core" + "xorm.io/xorm/v2/schemas" ) var ( diff --git a/dialects/mysql.go b/dialects/mysql.go index 2c061a14..878c34ce 100644 --- a/dialects/mysql.go +++ b/dialects/mysql.go @@ -14,8 +14,8 @@ import ( "strings" "time" - "xorm.io/xorm/core" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/core" + "xorm.io/xorm/v2/schemas" ) var ( diff --git a/dialects/oracle.go b/dialects/oracle.go index ac0fb944..0f32e2ff 100644 --- a/dialects/oracle.go +++ b/dialects/oracle.go @@ -13,8 +13,8 @@ import ( "strconv" "strings" - "xorm.io/xorm/core" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/core" + "xorm.io/xorm/v2/schemas" ) var ( diff --git a/dialects/postgres.go b/dialects/postgres.go index 99574459..044dca79 100644 --- a/dialects/postgres.go +++ b/dialects/postgres.go @@ -13,8 +13,8 @@ import ( "strconv" "strings" - "xorm.io/xorm/core" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/core" + "xorm.io/xorm/v2/schemas" ) // from http://www.postgresql.org/docs/current/static/sql-keywords-appendix.html diff --git a/dialects/sqlite3.go b/dialects/sqlite3.go index 62519b6b..c1937109 100644 --- a/dialects/sqlite3.go +++ b/dialects/sqlite3.go @@ -12,8 +12,8 @@ import ( "regexp" "strings" - "xorm.io/xorm/core" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/core" + "xorm.io/xorm/v2/schemas" ) var ( diff --git a/dialects/table_name.go b/dialects/table_name.go index 8a0baeac..f7c2cae0 100644 --- a/dialects/table_name.go +++ b/dialects/table_name.go @@ -9,9 +9,9 @@ import ( "reflect" "strings" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/names" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/names" + "xorm.io/xorm/v2/schemas" ) // TableNameWithSchema will add schema prefix on table name if possible diff --git a/dialects/table_name_test.go b/dialects/table_name_test.go index 66edc2b4..5bacaa98 100644 --- a/dialects/table_name_test.go +++ b/dialects/table_name_test.go @@ -7,7 +7,7 @@ package dialects import ( "testing" - "xorm.io/xorm/names" + "xorm.io/xorm/v2/names" "github.com/stretchr/testify/assert" ) diff --git a/dialects/time.go b/dialects/time.go index cdc896be..66bce5ff 100644 --- a/dialects/time.go +++ b/dialects/time.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) // FormatColumnTime format column time diff --git a/dialects/time_test.go b/dialects/time_test.go index 670207c6..cb759380 100644 --- a/dialects/time_test.go +++ b/dialects/time_test.go @@ -9,7 +9,7 @@ import ( "time" "github.com/stretchr/testify/assert" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) type dialect struct { diff --git a/engine.go b/engine.go index 0cbfdede..d0894d06 100644 --- a/engine.go +++ b/engine.go @@ -17,15 +17,15 @@ import ( "strings" "time" - "xorm.io/xorm/caches" - "xorm.io/xorm/contexts" - "xorm.io/xorm/core" - "xorm.io/xorm/dialects" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/log" - "xorm.io/xorm/names" - "xorm.io/xorm/schemas" - "xorm.io/xorm/tags" + "xorm.io/xorm/v2/caches" + "xorm.io/xorm/v2/contexts" + "xorm.io/xorm/v2/core" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/log" + "xorm.io/xorm/v2/names" + "xorm.io/xorm/v2/schemas" + "xorm.io/xorm/v2/tags" ) // Engine is the major struct of xorm, it means a database manager. diff --git a/engine_group.go b/engine_group.go index f2fe913d..d718c556 100644 --- a/engine_group.go +++ b/engine_group.go @@ -8,11 +8,11 @@ import ( "context" "time" - "xorm.io/xorm/caches" - "xorm.io/xorm/contexts" - "xorm.io/xorm/dialects" - "xorm.io/xorm/log" - "xorm.io/xorm/names" + "xorm.io/xorm/v2/caches" + "xorm.io/xorm/v2/contexts" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/log" + "xorm.io/xorm/v2/names" ) // EngineGroup defines an engine group diff --git a/go.mod b/go.mod index b48b3bbc..24ca9a6f 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,12 @@ -module xorm.io/xorm +module xorm.io/xorm/v2 -go 1.16 +go 1.18 require ( gitee.com/travelliu/dm v1.8.11192 github.com/denisenkom/go-mssqldb v0.12.3 github.com/go-sql-driver/mysql v1.7.0 github.com/goccy/go-json v0.8.1 - github.com/golang/snappy v0.0.4 // indirect github.com/jackc/pgx/v4 v4.18.0 github.com/json-iterator/go v1.1.12 github.com/lib/pq v1.10.7 @@ -18,4 +17,42 @@ require ( github.com/ziutek/mymysql v1.5.4 modernc.org/sqlite v1.20.4 xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978 + xorm.io/xorm v1.3.4 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dustin/go-humanize v1.0.0 // indirect + github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect + github.com/golang-sql/sqlexp v0.1.0 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/jackc/chunkreader/v2 v2.0.1 // indirect + github.com/jackc/pgconn v1.14.0 // indirect + github.com/jackc/pgio v1.0.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgproto3/v2 v2.3.2 // indirect + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/pgtype v1.14.0 // indirect + github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect + github.com/mattn/go-isatty v0.0.16 // indirect + github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect + golang.org/x/crypto v0.6.0 // indirect + golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect + golang.org/x/tools v0.1.12 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + lukechampine.com/uint128 v1.2.0 // indirect + modernc.org/cc/v3 v3.40.0 // indirect + modernc.org/ccgo/v3 v3.16.13 // indirect + modernc.org/libc v1.22.2 // indirect + modernc.org/mathutil v1.5.0 // indirect + modernc.org/memory v1.4.0 // indirect + modernc.org/opt v0.1.3 // indirect + modernc.org/strutil v1.1.3 // indirect + modernc.org/token v1.0.1 // indirect ) diff --git a/go.sum b/go.sum index 5c780ec6..f4f0eee4 100644 --- a/go.sum +++ b/go.sum @@ -55,7 +55,6 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= -github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= @@ -76,7 +75,6 @@ github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5W github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A= github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= @@ -343,3 +341,5 @@ modernc.org/z v1.7.0 h1:xkDw/KepgEjeizO2sNco+hqYkU12taxQFqPEmgm1GWE= modernc.org/z v1.7.0/go.mod h1:hVdgNMh8ggTuRG1rGU8x+xGRFfiQUIAw0ZqlPy8+HyQ= xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978 h1:bvLlAPW1ZMTWA32LuZMBEGHAUOcATZjzHcotf3SWweM= xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE= +xorm.io/xorm v1.3.4 h1:vWFKzR3DhGUDl5b4srhUjhDwjxkZAc4C7BFszpu0swI= +xorm.io/xorm v1.3.4/go.mod h1:qFJGFoVYbbIdnz2vaL5OxSQ2raleMpyRRalnq3n9OJo= diff --git a/interface.go b/interface.go index 03dfd236..01329b5f 100644 --- a/interface.go +++ b/interface.go @@ -10,12 +10,12 @@ import ( "reflect" "time" - "xorm.io/xorm/caches" - "xorm.io/xorm/contexts" - "xorm.io/xorm/dialects" - "xorm.io/xorm/log" - "xorm.io/xorm/names" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/caches" + "xorm.io/xorm/v2/contexts" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/log" + "xorm.io/xorm/v2/names" + "xorm.io/xorm/v2/schemas" ) // Interface defines the interface which Engine, EngineGroup and Session will implementate. diff --git a/internal/statements/cache.go b/internal/statements/cache.go index 9dd76754..e6277fd3 100644 --- a/internal/statements/cache.go +++ b/internal/statements/cache.go @@ -9,8 +9,8 @@ import ( "strconv" "strings" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/schemas" ) // ConvertIDSQL converts SQL with id diff --git a/internal/statements/column_map.go b/internal/statements/column_map.go index bb764b4e..bd93916e 100644 --- a/internal/statements/column_map.go +++ b/internal/statements/column_map.go @@ -7,7 +7,7 @@ package statements import ( "strings" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) type columnMap []string diff --git a/internal/statements/cond.go b/internal/statements/cond.go index dfc6c208..43ea11f7 100644 --- a/internal/statements/cond.go +++ b/internal/statements/cond.go @@ -6,7 +6,7 @@ package statements import ( "xorm.io/builder" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) type QuoteReplacer struct { diff --git a/internal/statements/delete.go b/internal/statements/delete.go index 6e859399..f1de09f1 100644 --- a/internal/statements/delete.go +++ b/internal/statements/delete.go @@ -10,8 +10,8 @@ import ( "time" "xorm.io/builder" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/schemas" ) func (statement *Statement) writeDeleteOrder(w *builder.BytesWriter) error { diff --git a/internal/statements/expr.go b/internal/statements/expr.go index c2a2e1cc..39d01cfa 100644 --- a/internal/statements/expr.go +++ b/internal/statements/expr.go @@ -9,7 +9,7 @@ import ( "strings" "xorm.io/builder" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) // ErrUnsupportedExprType represents an error with unsupported express type @@ -59,7 +59,7 @@ func (expr *Expr) WriteArgs(w *builder.BytesWriter) error { type exprParams []Expr func (exprs exprParams) ColNames() []string { - var cols = make([]string, 0, len(exprs)) + cols := make([]string, 0, len(exprs)) for _, expr := range exprs { cols = append(cols, expr.ColName) } diff --git a/internal/statements/insert.go b/internal/statements/insert.go index aa396431..572f495e 100644 --- a/internal/statements/insert.go +++ b/internal/statements/insert.go @@ -10,8 +10,8 @@ import ( "strings" "xorm.io/builder" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/schemas" ) func (statement *Statement) writeInsertOutput(buf *strings.Builder, table *schemas.Table) error { diff --git a/internal/statements/join.go b/internal/statements/join.go index 740b31de..efc52610 100644 --- a/internal/statements/join.go +++ b/internal/statements/join.go @@ -9,9 +9,9 @@ import ( "strings" "xorm.io/builder" - "xorm.io/xorm/dialects" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/schemas" ) // Join The joinOP should be one of INNER, LEFT OUTER, CROSS etc - this will be prepended to JOIN diff --git a/internal/statements/pagination.go b/internal/statements/pagination.go index 3c7a3913..5f836c3b 100644 --- a/internal/statements/pagination.go +++ b/internal/statements/pagination.go @@ -9,7 +9,7 @@ import ( "fmt" "xorm.io/builder" - "xorm.io/xorm/internal/utils" + "xorm.io/xorm/v2/internal/utils" ) func (statement *Statement) writePagination(bw *builder.BytesWriter) error { diff --git a/internal/statements/pk.go b/internal/statements/pk.go index 59da89c0..3489f929 100644 --- a/internal/statements/pk.go +++ b/internal/statements/pk.go @@ -9,7 +9,7 @@ import ( "reflect" "xorm.io/builder" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) var ( @@ -91,7 +91,7 @@ func (statement *Statement) ProcessIDParam() error { } for i, col := range statement.RefTable.PKColumns() { - var colName = statement.colName(col, statement.TableName()) + colName := statement.colName(col, statement.TableName()) statement.cond = statement.cond.And(builder.Eq{colName: statement.idParam[i]}) } return nil diff --git a/internal/statements/query.go b/internal/statements/query.go index 8a9e59e4..960afc36 100644 --- a/internal/statements/query.go +++ b/internal/statements/query.go @@ -11,7 +11,7 @@ import ( "strings" "xorm.io/builder" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) // GenQuerySQL generate query SQL diff --git a/internal/statements/select.go b/internal/statements/select.go index 59161d76..292e2da1 100644 --- a/internal/statements/select.go +++ b/internal/statements/select.go @@ -8,7 +8,7 @@ import ( "fmt" "strings" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) // Select replace select diff --git a/internal/statements/statement.go b/internal/statements/statement.go index 55a3d89e..cce33701 100644 --- a/internal/statements/statement.go +++ b/internal/statements/statement.go @@ -14,13 +14,13 @@ import ( "time" "xorm.io/builder" - "xorm.io/xorm/contexts" - "xorm.io/xorm/convert" - "xorm.io/xorm/dialects" - "xorm.io/xorm/internal/json" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" - "xorm.io/xorm/tags" + "xorm.io/xorm/v2/contexts" + "xorm.io/xorm/v2/convert" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/internal/json" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/schemas" + "xorm.io/xorm/v2/tags" ) var ( diff --git a/internal/statements/statement_args.go b/internal/statements/statement_args.go index 727d5977..e9077e1f 100644 --- a/internal/statements/statement_args.go +++ b/internal/statements/statement_args.go @@ -6,7 +6,7 @@ package statements import ( "xorm.io/builder" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) // WriteArg writes an arg diff --git a/internal/statements/statement_test.go b/internal/statements/statement_test.go index 31428efa..7fba9e3f 100644 --- a/internal/statements/statement_test.go +++ b/internal/statements/statement_test.go @@ -12,11 +12,11 @@ import ( "time" "github.com/stretchr/testify/assert" - "xorm.io/xorm/caches" - "xorm.io/xorm/dialects" - "xorm.io/xorm/names" - "xorm.io/xorm/schemas" - "xorm.io/xorm/tags" + "xorm.io/xorm/v2/caches" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/names" + "xorm.io/xorm/v2/schemas" + "xorm.io/xorm/v2/tags" _ "github.com/mattn/go-sqlite3" ) diff --git a/internal/statements/table_name.go b/internal/statements/table_name.go index 1396b7df..94cdea3f 100644 --- a/internal/statements/table_name.go +++ b/internal/statements/table_name.go @@ -9,7 +9,7 @@ import ( "strings" "xorm.io/builder" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) // TableName return current tableName diff --git a/internal/statements/update.go b/internal/statements/update.go index 5d71f34d..0287a368 100644 --- a/internal/statements/update.go +++ b/internal/statements/update.go @@ -12,11 +12,11 @@ import ( "time" "xorm.io/builder" - "xorm.io/xorm/convert" - "xorm.io/xorm/dialects" - "xorm.io/xorm/internal/json" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/convert" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/internal/json" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/schemas" ) func (statement *Statement) ifAddColUpdate(col *schemas.Column, includeVersion, includeUpdated, includeNil, diff --git a/internal/statements/values.go b/internal/statements/values.go index 4c1360ed..5f364c6d 100644 --- a/internal/statements/values.go +++ b/internal/statements/values.go @@ -12,10 +12,10 @@ import ( "reflect" "time" - "xorm.io/xorm/convert" - "xorm.io/xorm/dialects" - "xorm.io/xorm/internal/json" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/convert" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/internal/json" + "xorm.io/xorm/v2/schemas" ) var ( diff --git a/log/logger_context.go b/log/logger_context.go index 46802576..9a1bb4f3 100644 --- a/log/logger_context.go +++ b/log/logger_context.go @@ -7,7 +7,7 @@ package log import ( "fmt" - "xorm.io/xorm/contexts" + "xorm.io/xorm/v2/contexts" ) // LogContext represents a log context @@ -35,9 +35,7 @@ type ContextLogger interface { IsShowSQL() bool } -var ( - _ ContextLogger = &LoggerAdapter{} -) +var _ ContextLogger = &LoggerAdapter{} // enumerate all the context keys var ( diff --git a/rows.go b/rows.go index c539410e..3bc1268e 100644 --- a/rows.go +++ b/rows.go @@ -10,7 +10,7 @@ import ( "reflect" "xorm.io/builder" - "xorm.io/xorm/core" + "xorm.io/xorm/v2/core" ) // Rows rows wrapper a rows to diff --git a/scan.go b/scan.go index 00cee4d7..e8f65b64 100644 --- a/scan.go +++ b/scan.go @@ -11,10 +11,10 @@ import ( "reflect" "time" - "xorm.io/xorm/convert" - "xorm.io/xorm/core" - "xorm.io/xorm/dialects" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/convert" + "xorm.io/xorm/v2/core" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/schemas" ) // genScanResultsByBeanNullabale generates scan result diff --git a/schemas/pk.go b/schemas/pk.go index da3c7899..83710faf 100644 --- a/schemas/pk.go +++ b/schemas/pk.go @@ -8,7 +8,7 @@ import ( "bytes" "encoding/gob" - "xorm.io/xorm/internal/utils" + "xorm.io/xorm/v2/internal/utils" ) // PK represents primary key values diff --git a/session.go b/session.go index 14d0781e..f25ce90d 100644 --- a/session.go +++ b/session.go @@ -16,13 +16,14 @@ import ( "io" "reflect" "strconv" - "xorm.io/xorm/contexts" - "xorm.io/xorm/convert" - "xorm.io/xorm/core" - "xorm.io/xorm/internal/json" - "xorm.io/xorm/internal/statements" - "xorm.io/xorm/log" - "xorm.io/xorm/schemas" + + "xorm.io/xorm/v2/contexts" + "xorm.io/xorm/v2/convert" + "xorm.io/xorm/v2/core" + "xorm.io/xorm/v2/internal/json" + "xorm.io/xorm/v2/internal/statements" + "xorm.io/xorm/v2/log" + "xorm.io/xorm/v2/schemas" ) // ErrFieldIsNotExist columns does not exist diff --git a/session_cols.go b/session_cols.go index ca3589ab..a0019425 100644 --- a/session_cols.go +++ b/session_cols.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) func setColumnInt(bean interface{}, col *schemas.Column, t int64) { diff --git a/session_delete.go b/session_delete.go index 7336040f..ab94dd55 100644 --- a/session_delete.go +++ b/session_delete.go @@ -9,8 +9,8 @@ import ( "strconv" "xorm.io/builder" - "xorm.io/xorm/caches" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/caches" + "xorm.io/xorm/v2/schemas" ) // ErrNeedDeletedCond delete needs less one condition error diff --git a/session_find.go b/session_find.go index 1026910c..a0723a40 100644 --- a/session_find.go +++ b/session_find.go @@ -11,11 +11,11 @@ import ( "strings" "xorm.io/builder" - "xorm.io/xorm/caches" - "xorm.io/xorm/convert" - "xorm.io/xorm/internal/statements" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/caches" + "xorm.io/xorm/v2/convert" + "xorm.io/xorm/v2/internal/statements" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/schemas" ) const ( diff --git a/session_get.go b/session_get.go index 0d590330..ca087ee8 100644 --- a/session_get.go +++ b/session_get.go @@ -13,17 +13,15 @@ import ( "strconv" "time" - "xorm.io/xorm/caches" - "xorm.io/xorm/convert" - "xorm.io/xorm/core" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/caches" + "xorm.io/xorm/v2/convert" + "xorm.io/xorm/v2/core" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/schemas" ) -var ( - // ErrObjectIsNil return error of object is nil - ErrObjectIsNil = errors.New("object should not be nil") -) +// ErrObjectIsNil return error of object is nil +var ErrObjectIsNil = errors.New("object should not be nil") // Get retrieve one record from database, bean's non-empty fields // will be as conditions @@ -66,7 +64,7 @@ func (session *Session) get(beans ...interface{}) (bool, error) { return false, ErrObjectIsNil } - var isStruct = beanValue.Elem().Kind() == reflect.Struct && !isPtrOfTime(beans[0]) + isStruct := beanValue.Elem().Kind() == reflect.Struct && !isPtrOfTime(beans[0]) if isStruct { if err := session.statement.SetRefBean(beans[0]); err != nil { return false, err @@ -212,7 +210,7 @@ func (session *Session) getSlice(rows *core.Rows, types []*sql.ColumnType, field return err } - var needAppend = len(*t) == 0 // both support slice is empty or has been initlized + needAppend := len(*t) == 0 // both support slice is empty or has been initlized for i, r := range res { if needAppend { *t = append(*t, r.(*sql.NullString).String) @@ -226,7 +224,7 @@ func (session *Session) getSlice(rows *core.Rows, types []*sql.ColumnType, field if err != nil { return err } - var needAppend = len(*t) == 0 + needAppend := len(*t) == 0 for ii := range fields { s, err := convert.Interface2Interface(session.engine.DatabaseTZ, scanResults[ii]) if err != nil { @@ -294,7 +292,7 @@ func (session *Session) cacheGet(bean interface{}, sqlStr string, args ...interf table := session.statement.RefTable ids, err := caches.GetCacheSql(cacher, tableName, newsql, args) if err != nil { - var res = make([]string, len(table.PrimaryKeys)) + res := make([]string, len(table.PrimaryKeys)) rows, err := session.NoCache().queryRows(newsql, args...) if err != nil { return false, err diff --git a/session_insert.go b/session_insert.go index 7003e0f7..ae19d366 100644 --- a/session_insert.go +++ b/session_insert.go @@ -13,10 +13,10 @@ import ( "time" "xorm.io/builder" - "xorm.io/xorm/convert" - "xorm.io/xorm/dialects" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/convert" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/schemas" ) // ErrNoElementsOnSlice represents an error there is no element when insert diff --git a/session_iterate.go b/session_iterate.go index afb9a7cc..7786f381 100644 --- a/session_iterate.go +++ b/session_iterate.go @@ -7,7 +7,7 @@ package xorm import ( "reflect" - "xorm.io/xorm/internal/utils" + "xorm.io/xorm/v2/internal/utils" ) // IterFunc only use by Iterate @@ -64,15 +64,15 @@ func (session *Session) BufferSize(size int) *Session { } func (session *Session) bufferIterate(bean interface{}, fun IterFunc) error { - var bufferSize = session.statement.BufferSize - var pLimitN = session.statement.LimitN + bufferSize := session.statement.BufferSize + pLimitN := session.statement.LimitN if pLimitN != nil && bufferSize > *pLimitN { bufferSize = *pLimitN } - var start = session.statement.Start + start := session.statement.Start v := utils.ReflectValue(bean) sliceType := reflect.SliceOf(v.Type()) - var idx = 0 + idx := 0 session.autoResetStatement = false defer func() { session.autoResetStatement = true diff --git a/session_raw.go b/session_raw.go index 99f6be99..664fe2ca 100644 --- a/session_raw.go +++ b/session_raw.go @@ -8,7 +8,7 @@ import ( "database/sql" "strings" - "xorm.io/xorm/core" + "xorm.io/xorm/v2/core" ) func (session *Session) queryPreprocess(sqlStr *string, paramStr ...interface{}) { diff --git a/session_schema.go b/session_schema.go index 830ba08a..4587a02c 100644 --- a/session_schema.go +++ b/session_schema.go @@ -13,8 +13,8 @@ import ( "os" "strings" - "xorm.io/xorm/dialects" - "xorm.io/xorm/internal/utils" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/internal/utils" ) // Ping test if database is ok diff --git a/session_update.go b/session_update.go index b3640ad2..e4fdbea3 100644 --- a/session_update.go +++ b/session_update.go @@ -8,9 +8,9 @@ import ( "reflect" "xorm.io/builder" - "xorm.io/xorm/internal/statements" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/internal/statements" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/schemas" ) // enumerated all errors diff --git a/sync.go b/sync.go index adc2d859..d9423289 100644 --- a/sync.go +++ b/sync.go @@ -7,8 +7,8 @@ package xorm import ( "strings" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/schemas" ) type SyncOptions struct { diff --git a/tags/parser.go b/tags/parser.go index 53ef0c10..f25aa64b 100644 --- a/tags/parser.go +++ b/tags/parser.go @@ -14,11 +14,11 @@ import ( "time" "unicode" - "xorm.io/xorm/caches" - "xorm.io/xorm/convert" - "xorm.io/xorm/dialects" - "xorm.io/xorm/names" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/caches" + "xorm.io/xorm/v2/convert" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/names" + "xorm.io/xorm/v2/schemas" ) // ErrUnsupportedType represents an unsupported type error diff --git a/tags/parser_test.go b/tags/parser_test.go index 434cfc07..cb9d8368 100644 --- a/tags/parser_test.go +++ b/tags/parser_test.go @@ -10,10 +10,10 @@ import ( "testing" "time" - "xorm.io/xorm/caches" - "xorm.io/xorm/dialects" - "xorm.io/xorm/names" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/caches" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/names" + "xorm.io/xorm/v2/schemas" "github.com/stretchr/testify/assert" ) diff --git a/tags/tag.go b/tags/tag.go index 024c9c18..05654375 100644 --- a/tags/tag.go +++ b/tags/tag.go @@ -11,7 +11,7 @@ import ( "strings" "time" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) type tag struct { diff --git a/tests/cache_test.go b/tests/cache_test.go index c3f84c77..03b6fc0d 100644 --- a/tests/cache_test.go +++ b/tests/cache_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "xorm.io/xorm/caches" + "xorm.io/xorm/v2/caches" "github.com/stretchr/testify/assert" ) diff --git a/tests/engine_dm_test.go b/tests/engine_dm_test.go index 5b25af29..9d4a0e66 100644 --- a/tests/engine_dm_test.go +++ b/tests/engine_dm_test.go @@ -7,7 +7,7 @@ package tests -import "xorm.io/xorm/schemas" +import "xorm.io/xorm/v2/schemas" func init() { dbtypes = append(dbtypes, schemas.DAMENG) diff --git a/tests/engine_group_test.go b/tests/engine_group_test.go index 629e0aa4..b95ce8eb 100644 --- a/tests/engine_group_test.go +++ b/tests/engine_group_test.go @@ -8,8 +8,8 @@ import ( "testing" "xorm.io/xorm" - "xorm.io/xorm/log" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/log" + "xorm.io/xorm/v2/schemas" "github.com/stretchr/testify/assert" ) diff --git a/tests/engine_test.go b/tests/engine_test.go index 79ca42f5..282a96c2 100644 --- a/tests/engine_test.go +++ b/tests/engine_test.go @@ -12,7 +12,7 @@ import ( "time" "xorm.io/xorm" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" _ "gitee.com/travelliu/dm" _ "github.com/denisenkom/go-mssqldb" diff --git a/tests/schema_test.go b/tests/schema_test.go index db9f9e8f..679cf8d5 100644 --- a/tests/schema_test.go +++ b/tests/schema_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/assert" "xorm.io/xorm" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) func TestStoreEngine(t *testing.T) { @@ -716,7 +716,6 @@ func TestSyncWithOptions(t *testing.T) { tableInfoFromStruct, _ := testEngine.TableInfo(&SyncWithOpts1{}) assert.ElementsMatch(t, getKeysFromMap(tableInfoFromStruct.Indexes), getKeysFromMap(getIndicesOfBeanFromDB(t, &SyncWithOpts1{}))) - } func getIndicesOfBeanFromDB(t *testing.T, bean interface{}) map[string]*schemas.Index { diff --git a/tests/session_cols_test.go b/tests/session_cols_test.go index 4a6ef39f..d2b441d0 100644 --- a/tests/session_cols_test.go +++ b/tests/session_cols_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "xorm.io/builder" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) func TestSetExpr(t *testing.T) { diff --git a/tests/session_delete_test.go b/tests/session_delete_test.go index 44d4ad7d..afc9afbf 100644 --- a/tests/session_delete_test.go +++ b/tests/session_delete_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" - "xorm.io/xorm/caches" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/caches" + "xorm.io/xorm/v2/schemas" "github.com/stretchr/testify/assert" ) diff --git a/tests/session_find_test.go b/tests/session_find_test.go index d991e6ba..c2ae1e92 100644 --- a/tests/session_find_test.go +++ b/tests/session_find_test.go @@ -10,9 +10,9 @@ import ( "xorm.io/builder" "xorm.io/xorm" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/names" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/names" + "xorm.io/xorm/v2/schemas" "github.com/stretchr/testify/assert" ) diff --git a/tests/session_get_test.go b/tests/session_get_test.go index 2ff2f67d..0258f55e 100644 --- a/tests/session_get_test.go +++ b/tests/session_get_test.go @@ -13,10 +13,10 @@ import ( "time" "xorm.io/xorm" - "xorm.io/xorm/contexts" - "xorm.io/xorm/convert" - "xorm.io/xorm/dialects" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/contexts" + "xorm.io/xorm/v2/convert" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/schemas" "github.com/shopspring/decimal" "github.com/stretchr/testify/assert" diff --git a/tests/session_insert_test.go b/tests/session_insert_test.go index e45e6e54..942842c0 100644 --- a/tests/session_insert_test.go +++ b/tests/session_insert_test.go @@ -11,7 +11,7 @@ import ( "time" "xorm.io/xorm" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" "github.com/stretchr/testify/assert" ) diff --git a/tests/session_pk_test.go b/tests/session_pk_test.go index baf84547..3deca56a 100644 --- a/tests/session_pk_test.go +++ b/tests/session_pk_test.go @@ -10,7 +10,7 @@ import ( "time" "github.com/stretchr/testify/assert" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" ) type IntId struct { diff --git a/tests/session_query_test.go b/tests/session_query_test.go index 726b19e2..3ad99238 100644 --- a/tests/session_query_test.go +++ b/tests/session_query_test.go @@ -12,7 +12,7 @@ import ( "xorm.io/builder" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/schemas" "github.com/stretchr/testify/assert" ) @@ -493,4 +493,4 @@ func TestRowsReset(t *testing.T) { assert.EqualValues(t, "4", rrs[0].Name) assert.EqualValues(t, "5", rrs[1].Name) assert.EqualValues(t, "6", rrs[2].Name) -} \ No newline at end of file +} diff --git a/tests/session_raw_test.go b/tests/session_raw_test.go index 569d7bed..f74a4be4 100644 --- a/tests/session_raw_test.go +++ b/tests/session_raw_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "xorm.io/xorm/convert" + "xorm.io/xorm/v2/convert" "github.com/stretchr/testify/assert" ) diff --git a/tests/session_tx_test.go b/tests/session_tx_test.go index c9db40ba..3a181d10 100644 --- a/tests/session_tx_test.go +++ b/tests/session_tx_test.go @@ -10,8 +10,8 @@ import ( "time" "github.com/stretchr/testify/assert" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/names" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/names" ) func TestTransaction(t *testing.T) { diff --git a/tests/session_update_test.go b/tests/session_update_test.go index c13468d9..70468c12 100644 --- a/tests/session_update_test.go +++ b/tests/session_update_test.go @@ -12,10 +12,10 @@ import ( "github.com/stretchr/testify/assert" "xorm.io/xorm" - "xorm.io/xorm/internal/statements" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/names" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/internal/statements" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/names" + "xorm.io/xorm/v2/schemas" ) func TestUpdateMap(t *testing.T) { diff --git a/tests/tags_test.go b/tests/tags_test.go index f8448b4a..fee3c597 100644 --- a/tests/tags_test.go +++ b/tests/tags_test.go @@ -12,9 +12,9 @@ import ( "time" "github.com/stretchr/testify/assert" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/names" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/internal/utils" + "xorm.io/xorm/v2/names" + "xorm.io/xorm/v2/schemas" ) type tempUser struct { diff --git a/tests/tests.go b/tests/tests.go index 220e1c67..a4e3646b 100644 --- a/tests/tests.go +++ b/tests/tests.go @@ -14,11 +14,11 @@ import ( "testing" "xorm.io/xorm" - "xorm.io/xorm/caches" - "xorm.io/xorm/dialects" - "xorm.io/xorm/log" - "xorm.io/xorm/names" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/caches" + "xorm.io/xorm/v2/dialects" + "xorm.io/xorm/v2/log" + "xorm.io/xorm/v2/names" + "xorm.io/xorm/v2/schemas" ) var ( diff --git a/tests/time_test.go b/tests/time_test.go index 13b9ed15..ebb50fc6 100644 --- a/tests/time_test.go +++ b/tests/time_test.go @@ -11,9 +11,9 @@ import ( "testing" "time" - "xorm.io/xorm/convert" + "xorm.io/xorm/v2/convert" - "xorm.io/xorm/internal/utils" + "xorm.io/xorm/v2/internal/utils" "github.com/stretchr/testify/assert" ) diff --git a/tests/types_test.go b/tests/types_test.go index dfdb4766..d3e155d4 100644 --- a/tests/types_test.go +++ b/tests/types_test.go @@ -13,9 +13,9 @@ import ( "testing" "xorm.io/xorm" - "xorm.io/xorm/convert" - "xorm.io/xorm/internal/json" - "xorm.io/xorm/schemas" + "xorm.io/xorm/v2/convert" + "xorm.io/xorm/v2/internal/json" + "xorm.io/xorm/v2/schemas" "github.com/stretchr/testify/assert" )