From 5f3bad1949de0b25a51656f4818c0857376ece6b Mon Sep 17 00:00:00 2001 From: Nicolas Chiappero Date: Fri, 19 Mar 2021 12:10:55 +0100 Subject: [PATCH] [dialects/mssql.go] bugfix SQLType / GetColumns / GetTables / GetIndexes [dialects/postgres.go] bugfix SQLType [engine.go] use github.com/alexbrainman/odbc for odbc - bugfix objectId - add log - bugfix null value - bugfix sql server identity [schemas/index.go] bugfix index name generatin [schemas/table.go] add ObjectId field [schemas/type.go] add DateTime2 type [*] replace module xorm.io/xorm by gitea.com/nikos06/xorm --- Makefile | 4 +- caches/cache.go | 2 +- caches/lru_test.go | 2 +- core/db.go | 6 +- core/db_test.go | 2 +- core/stmt.go | 2 +- core/tx.go | 2 +- dialects/dialect.go | 4 +- dialects/mssql.go | 26 +++++--- dialects/mysql.go | 4 +- dialects/oracle.go | 4 +- dialects/postgres.go | 18 +++++- dialects/sqlite3.go | 4 +- dialects/table_name.go | 4 +- dialects/table_name_test.go | 2 +- dialects/time.go | 2 +- doc.go | 2 +- engine.go | 91 ++++++++++++++++++++++----- engine_group.go | 10 +-- go.mod | 5 +- go.sum | 16 +++++ integrations/cache_test.go | 2 +- integrations/engine_group_test.go | 6 +- integrations/engine_test.go | 4 +- integrations/processors_test.go | 2 +- integrations/session_cols_test.go | 2 +- integrations/session_delete_test.go | 4 +- integrations/session_find_test.go | 4 +- integrations/session_get_test.go | 4 +- integrations/session_insert_test.go | 2 +- integrations/session_pk_test.go | 2 +- integrations/session_query_test.go | 2 +- integrations/session_schema_test.go | 2 +- integrations/session_tx_test.go | 4 +- integrations/session_update_test.go | 10 +-- integrations/tags_test.go | 6 +- integrations/tests.go | 12 ++-- integrations/time_test.go | 2 +- integrations/types_test.go | 8 +-- interface.go | 12 ++-- internal/statements/cache.go | 4 +- internal/statements/column_map.go | 2 +- internal/statements/expr_param.go | 2 +- internal/statements/insert.go | 2 +- internal/statements/pk.go | 2 +- internal/statements/query.go | 2 +- internal/statements/statement.go | 14 ++--- internal/statements/statement_args.go | 2 +- internal/statements/statement_test.go | 10 +-- internal/statements/update.go | 10 +-- internal/statements/values.go | 8 +-- log/logger_context.go | 2 +- migrate/migrate.go | 2 +- migrate/migrate_test.go | 2 +- rows.go | 4 +- schemas/index.go | 9 ++- schemas/pk.go | 2 +- schemas/table.go | 1 + schemas/type.go | 4 +- session.go | 14 ++--- session_cols.go | 2 +- session_convert.go | 8 +-- session_delete.go | 4 +- session_find.go | 8 +-- session_get.go | 6 +- session_insert.go | 4 +- session_iterate.go | 2 +- session_query.go | 4 +- session_raw.go | 2 +- session_schema.go | 4 +- session_update.go | 6 +- tags/parser.go | 10 +-- tags/parser_test.go | 6 +- tags/tag.go | 2 +- tags/tag_test.go | 2 +- 75 files changed, 284 insertions(+), 186 deletions(-) diff --git a/Makefile b/Makefile index 0f0ddb6c..a39c32f6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -IMPORT := xorm.io/xorm +IMPORT := gitea.com/nikos06/xorm export GO111MODULE=on GO ?= go @@ -7,7 +7,7 @@ TAGS ?= SED_INPLACE := sed -i GOFILES := $(shell find . -name "*.go" -type f) -INTEGRATION_PACKAGES := xorm.io/xorm/integrations +INTEGRATION_PACKAGES := gitea.com/nikos06/xorm/integrations PACKAGES ?= $(filter-out $(INTEGRATION_PACKAGES),$(shell $(GO) list ./...)) TEST_COCKROACH_HOST ?= cockroach:26257 diff --git a/caches/cache.go b/caches/cache.go index 7b80eb88..97d57386 100644 --- a/caches/cache.go +++ b/caches/cache.go @@ -12,7 +12,7 @@ import ( "strings" "time" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/schemas" ) const ( diff --git a/caches/lru_test.go b/caches/lru_test.go index 771b924c..1023ce98 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" + "gitea.com/nikos06/xorm/schemas" ) func TestLRUCache(t *testing.T) { diff --git a/core/db.go b/core/db.go index 50c64c6f..c5f5650e 100644 --- a/core/db.go +++ b/core/db.go @@ -13,9 +13,9 @@ import ( "regexp" "sync" - "xorm.io/xorm/contexts" - "xorm.io/xorm/log" - "xorm.io/xorm/names" + "gitea.com/nikos06/xorm/contexts" + "gitea.com/nikos06/xorm/log" + "gitea.com/nikos06/xorm/names" ) var ( diff --git a/core/db_test.go b/core/db_test.go index 104c5b95..8d0bfaa4 100644 --- a/core/db_test.go +++ b/core/db_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "xorm.io/xorm/names" + "gitea.com/nikos06/xorm/names" _ "github.com/go-sql-driver/mysql" _ "github.com/mattn/go-sqlite3" diff --git a/core/stmt.go b/core/stmt.go index d46ac9c6..0903d4dc 100644 --- a/core/stmt.go +++ b/core/stmt.go @@ -10,7 +10,7 @@ import ( "errors" "reflect" - "xorm.io/xorm/contexts" + "gitea.com/nikos06/xorm/contexts" ) // Stmt reprents a stmt objects diff --git a/core/tx.go b/core/tx.go index a85a6874..61728897 100644 --- a/core/tx.go +++ b/core/tx.go @@ -8,7 +8,7 @@ import ( "context" "database/sql" - "xorm.io/xorm/contexts" + "gitea.com/nikos06/xorm/contexts" ) var ( diff --git a/dialects/dialect.go b/dialects/dialect.go index d9a640a4..f8f768a2 100644 --- a/dialects/dialect.go +++ b/dialects/dialect.go @@ -10,8 +10,8 @@ import ( "strings" "time" - "xorm.io/xorm/core" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/core" + "gitea.com/nikos06/xorm/schemas" ) // URI represents an uri to visit database diff --git a/dialects/mssql.go b/dialects/mssql.go index 083fb65d..82bd18fb 100644 --- a/dialects/mssql.go +++ b/dialects/mssql.go @@ -12,8 +12,8 @@ import ( "strconv" "strings" - "xorm.io/xorm/core" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/core" + "gitea.com/nikos06/xorm/schemas" ) var ( @@ -319,6 +319,12 @@ func (db *mssql) SQLType(c *schemas.Column) string { if c.Length == -1 { res += "(MAX)" } + case schemas.UniqueIdentifier: + res = t + c.Length = 0 + case schemas.Money: + res = t + c.Length = 0 default: res = t } @@ -395,18 +401,18 @@ func (db *mssql) IsTableExist(queryer core.Queryer, ctx context.Context, tableNa func (db *mssql) GetColumns(queryer core.Queryer, ctx context.Context, tableName string) ([]string, map[string]*schemas.Column, error) { args := []interface{}{} s := `select a.name as name, b.name as ctype,a.max_length,a.precision,a.scale,a.is_nullable as nullable, - "default_is_null" = (CASE WHEN c.text is null THEN 1 ELSE 0 END), - replace(replace(isnull(c.text,''),'(',''),')','') as vdefault, + "default_is_null" = (CASE WHEN c.definition is null THEN 1 ELSE 0 END), + replace(replace(isnull(c.definition,''),'(',''),')','') as vdefault, ISNULL(p.is_primary_key, 0), a.is_identity as is_identity from sys.columns a left join sys.types b on a.user_type_id=b.user_type_id - left join sys.syscomments c on a.default_object_id=c.id + left join sys.sql_modules c on a.object_id=c.object_id LEFT OUTER JOIN (SELECT i.object_id, ic.column_id, i.is_primary_key FROM sys.indexes i LEFT JOIN sys.index_columns ic ON ic.object_id = i.object_id AND ic.index_id = i.index_id WHERE i.is_primary_key = 1 ) as p on p.object_id = a.object_id AND p.column_id = a.column_id - where a.object_id=object_id('` + tableName + `')` + where a.object_id='` + tableName + `')` rows, err := queryer.QueryContext(ctx, s, args...) if err != nil { @@ -475,7 +481,7 @@ func (db *mssql) GetColumns(queryer core.Queryer, ctx context.Context, tableName func (db *mssql) GetTables(queryer core.Queryer, ctx context.Context) ([]*schemas.Table, error) { args := []interface{}{} - s := `select name from sysobjects where xtype ='U'` + s := `select name,object_id from sys.objects where type ='U'` rows, err := queryer.QueryContext(ctx, s, args...) if err != nil { @@ -487,11 +493,13 @@ func (db *mssql) GetTables(queryer core.Queryer, ctx context.Context) ([]*schema for rows.Next() { table := schemas.NewEmptyTable() var name string - err = rows.Scan(&name) + var objectId string + err = rows.Scan(&name, &objectId) if err != nil { return nil, err } table.Name = strings.Trim(name, "` ") + table.ObjectId = objectId tables = append(tables, table) } return tables, nil @@ -508,7 +516,7 @@ INNER JOIN SYS.INDEX_COLUMNS IXCS ON IXS.OBJECT_ID=IXCS.OBJECT_ID AND IXS.INDEX_ID = IXCS.INDEX_ID INNER JOIN SYS.COLUMNS C ON IXS.OBJECT_ID=C.OBJECT_ID AND IXCS.COLUMN_ID=C.COLUMN_ID -WHERE IXS.TYPE_DESC='NONCLUSTERED' and OBJECT_NAME(IXS.OBJECT_ID) =? +WHERE IXS.TYPE_DESC='NONCLUSTERED' and IXS.OBJECT_ID =? ` rows, err := queryer.QueryContext(ctx, s, args...) diff --git a/dialects/mysql.go b/dialects/mysql.go index 32e18a17..537f5979 100644 --- a/dialects/mysql.go +++ b/dialects/mysql.go @@ -14,8 +14,8 @@ import ( "strings" "time" - "xorm.io/xorm/core" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/core" + "gitea.com/nikos06/xorm/schemas" ) var ( diff --git a/dialects/oracle.go b/dialects/oracle.go index 91eed251..c7cdfec4 100644 --- a/dialects/oracle.go +++ b/dialects/oracle.go @@ -12,8 +12,8 @@ import ( "strconv" "strings" - "xorm.io/xorm/core" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/core" + "gitea.com/nikos06/xorm/schemas" ) var ( diff --git a/dialects/postgres.go b/dialects/postgres.go index a2c0de74..0855b291 100644 --- a/dialects/postgres.go +++ b/dialects/postgres.go @@ -12,8 +12,8 @@ import ( "strconv" "strings" - "xorm.io/xorm/core" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/core" + "gitea.com/nikos06/xorm/schemas" ) // from http://www.postgresql.org/docs/current/static/sql-keywords-appendix.html @@ -833,6 +833,9 @@ func (db *postgres) SQLType(c *schemas.Column) string { case schemas.Bit: res = schemas.Boolean return res + case schemas.SmallInt: + res = schemas.SmallInt + c.Length = 0 case schemas.MediumInt, schemas.Int, schemas.Integer: if c.IsAutoIncrement { return schemas.Serial @@ -851,10 +854,14 @@ func (db *postgres) SQLType(c *schemas.Column) string { return schemas.Bytea case schemas.DateTime: res = schemas.TimeStamp + c.Length = 0 + case schemas.DateTime2: + res = schemas.TimeStamp case schemas.TimeStampz: return "timestamp with time zone" case schemas.Float: - res = schemas.Real + res = schemas.Float + c.Length = 0 case schemas.TinyText, schemas.MediumText, schemas.LongText: res = schemas.Text case schemas.NChar: @@ -867,6 +874,11 @@ func (db *postgres) SQLType(c *schemas.Column) string { return schemas.Bytea case schemas.Double: return "DOUBLE PRECISION" + case schemas.UniqueIdentifier: + return schemas.Uuid + case schemas.Money: + res = t + c.Length = 0 default: if c.IsAutoIncrement { return schemas.Serial diff --git a/dialects/sqlite3.go b/dialects/sqlite3.go index 62a38397..8f867c46 100644 --- a/dialects/sqlite3.go +++ b/dialects/sqlite3.go @@ -12,8 +12,8 @@ import ( "regexp" "strings" - "xorm.io/xorm/core" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/core" + "gitea.com/nikos06/xorm/schemas" ) var ( diff --git a/dialects/table_name.go b/dialects/table_name.go index e190cd4b..c58718af 100644 --- a/dialects/table_name.go +++ b/dialects/table_name.go @@ -9,8 +9,8 @@ import ( "reflect" "strings" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/names" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/names" ) // 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..02981ff6 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" + "gitea.com/nikos06/xorm/names" "github.com/stretchr/testify/assert" ) diff --git a/dialects/time.go b/dialects/time.go index 9a3c82a4..ca3d9f9f 100644 --- a/dialects/time.go +++ b/dialects/time.go @@ -7,7 +7,7 @@ package dialects import ( "time" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/schemas" ) // FormatTime format time as column type diff --git a/doc.go b/doc.go index ea6a2226..4674e410 100644 --- a/doc.go +++ b/doc.go @@ -10,7 +10,7 @@ Installation Make sure you have installed Go 1.11+ and then: - go get xorm.io/xorm + go get gitea.com/nikos06/xorm Create Engine diff --git a/engine.go b/engine.go index ee98ed05..6e9e016d 100644 --- a/engine.go +++ b/engine.go @@ -17,15 +17,17 @@ 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" + "github.com/alexbrainman/odbc" + + "gitea.com/nikos06/xorm/caches" + "gitea.com/nikos06/xorm/contexts" + "gitea.com/nikos06/xorm/core" + "gitea.com/nikos06/xorm/dialects" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/log" + "gitea.com/nikos06/xorm/names" + "gitea.com/nikos06/xorm/schemas" + "gitea.com/nikos06/xorm/tags" ) // Engine is the major struct of xorm, it means a database manager. @@ -359,7 +361,7 @@ func (engine *Engine) NoAutoCondition(no ...bool) *Session { } func (engine *Engine) loadTableInfo(table *schemas.Table) error { - colSeq, cols, err := engine.dialect.GetColumns(engine.db, engine.defaultContext, table.Name) + colSeq, cols, err := engine.dialect.GetColumns(engine.db, engine.defaultContext, table.ObjectId) if err != nil { return err } @@ -405,6 +407,7 @@ func (engine *Engine) DBMetas() ([]*schemas.Table, error) { if err = engine.loadTableInfo(table); err != nil { return nil, err } + engine.logger.Debugf("Loaded schema for table %s", table.Name) } return tables, nil } @@ -445,6 +448,15 @@ func (engine *Engine) DumpTables(tables []*schemas.Table, w io.Writer, tp ...sch func formatColumnValue(dstDialect dialects.Dialect, d interface{}, col *schemas.Column) string { if d == nil { + if !col.Nullable { + if col.SQLType.IsText() { + return "''" + } else if col.SQLType.IsTime() { + return "0000-00-00 00:00:00" + } else if col.SQLType.IsNumeric() { + return "0" + } + } return "NULL" } @@ -519,6 +531,41 @@ func formatColumnValue(dstDialect dialects.Dialect, d interface{}, col *schemas. return s } +func isPrimaryKeyIdentity(table *schemas.Table) bool { + pkColumns := table.PKColumns() + if len(pkColumns) > 1 || len(pkColumns) <= 0 { + return false + } + switch t := pkColumns[0].SQLType.Name; t { + case schemas.Serial: + return false + case schemas.BigSerial: + return false + case schemas.TinyInt: + return true + case schemas.SmallInt: + return true + case schemas.MediumInt: + return true + case schemas.Int: + return true + case schemas.Integer: + return true + case schemas.BigInt: + return true + case schemas.Decimal: + return true + case schemas.Numeric: + return true + case schemas.SmallMoney: + return true + case schemas.Money: + return true + default: + return false + } +} + // dumpTables dump database all table structs and data to w with specify db type func (engine *Engine) dumpTables(tables []*schemas.Table, w io.Writer, tp ...schemas.DBType) error { var dstDialect dialects.Dialect @@ -566,7 +613,7 @@ func (engine *Engine) dumpTables(tables []*schemas.Table, w io.Writer, tp ...sch return err } } - if len(table.PKColumns()) > 0 && dstDialect.URI().DBType == schemas.MSSQL { + if dstDialect.URI().DBType == schemas.MSSQL && isPrimaryKeyIdentity(table) { fmt.Fprintf(w, "SET IDENTITY_INSERT [%s] ON;\n", table.Name) } @@ -583,6 +630,12 @@ func (engine *Engine) dumpTables(tables []*schemas.Table, w io.Writer, tp ...sch rows, err := engine.DB().QueryContext(engine.defaultContext, "SELECT "+colNames+" FROM "+engine.Quote(originalTableName)) if err != nil { + if odbcErr, ok := err.(*odbc.Error); ok { + if odbcErr.Diag[0].NativeError==40000 { + engine.logger.Errorf("Unable to dump records from table %s: %s", tableName, odbcErr) + continue + } + } return err } defer rows.Close() @@ -613,13 +666,17 @@ func (engine *Engine) dumpTables(tables []*schemas.Table, w io.Writer, tp ...sch } } - // FIXME: Hack for postgres - if dstDialect.URI().DBType == schemas.POSTGRES && table.AutoIncrColumn() != nil { - _, err = io.WriteString(w, "SELECT setval('"+tableName+"_id_seq', COALESCE((SELECT MAX("+table.AutoIncrColumn().Name+") + 1 FROM "+dstDialect.Quoter().Quote(tableName)+"), 1), false);\n") - if err != nil { - return err - } + if err := rows.Err(); err != nil { + return err } + + // FIXME: Hack for postgres + //if dstDialect.URI().DBType == schemas.POSTGRES && table.AutoIncrColumn() != nil { + // _, err = io.WriteString(w, "SELECT setval('"+tableName+"_id_seq', COALESCE((SELECT MAX("+table.AutoIncrColumn().Name+") + 1 FROM "+dstDialect.Quoter().Quote(tableName)+"), 1), false);\n") + // if err != nil { + // return err + // } + //} } return nil } diff --git a/engine_group.go b/engine_group.go index 3e91cbd6..47b8e4ae 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" + "gitea.com/nikos06/xorm/caches" + "gitea.com/nikos06/xorm/contexts" + "gitea.com/nikos06/xorm/dialects" + "gitea.com/nikos06/xorm/log" + "gitea.com/nikos06/xorm/names" ) // EngineGroup defines an engine group diff --git a/go.mod b/go.mod index b9eec3a0..6f8d71ed 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,11 @@ -module xorm.io/xorm +module gitea.com/nikos06/xorm go 1.11 require ( + github.com/alexbrainman/odbc v0.0.0-20200426075526-f0492dfa1575 github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc + github.com/go-ole/go-ole v1.2.5 // indirect github.com/go-sql-driver/mysql v1.5.0 github.com/lib/pq v1.7.0 github.com/mattn/go-sqlite3 v1.14.6 @@ -12,4 +14,5 @@ require ( github.com/ziutek/mymysql v1.5.4 modernc.org/sqlite v1.10.1-0.20210314190707-798bbeb9bb84 xorm.io/builder v0.3.8 + gitea.com/nikos06/xorm v1.0.7 ) diff --git a/go.sum b/go.sum index 7c72c699..d7d33082 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,9 @@ gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s= gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU= +github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= +github.com/alexbrainman/odbc v0.0.0-20200426075526-f0492dfa1575 h1:amPgE3QaxNogld1zImkopnrJQkJN51DE7ngVykqVVYE= +github.com/alexbrainman/odbc v0.0.0-20200426075526-f0492dfa1575/go.mod h1:WEQLoRNIjBhywJqaxe0olilzzBDABc5EVeETiprzR00= +github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzqk8QCaRC4os14xoKDdbHqqlJtJA0oc1ZAjg= @@ -8,6 +12,8 @@ github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4 github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY= +github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY= @@ -26,6 +32,7 @@ github.com/lib/pq v1.7.0 h1:h93mCPfUSkaul3Ka/VG8uZdmW1uMHDGxzu0NWHuJmHY= github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -53,9 +60,12 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnk golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -63,9 +73,12 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181011152604-fa43e7bc11ba/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk= @@ -118,5 +131,8 @@ modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/z v1.0.1-0.20210308123920-1f282aa71362/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA= modernc.org/z v1.0.1 h1:WyIDpEpAIx4Hel6q/Pcgj/VhaQV5XPJ2I6ryIYbjnpc= modernc.org/z v1.0.1/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA= +xorm.io/builder v0.3.7/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE= xorm.io/builder v0.3.8 h1:P/wPgRqa9kX5uE0aA1/ukJ23u9KH0aSRpHLwDKXigSE= xorm.io/builder v0.3.8/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE= +gitea.com/nikos06/xorm v1.0.7 h1:26yBTDVI+CfQpVz2Y88fISh+aiJXIPP4eNoTJlwzsC4= +gitea.com/nikos06/xorm v1.0.7/go.mod h1:uF9EtbhODq5kNWxMbnBEj8hRRZnlcNSz2t2N7HW/+A4= diff --git a/integrations/cache_test.go b/integrations/cache_test.go index 44e817b1..12b38f2a 100644 --- a/integrations/cache_test.go +++ b/integrations/cache_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "xorm.io/xorm/caches" + "gitea.com/nikos06/xorm/caches" "github.com/stretchr/testify/assert" ) diff --git a/integrations/engine_group_test.go b/integrations/engine_group_test.go index 635f73a6..d02af652 100644 --- a/integrations/engine_group_test.go +++ b/integrations/engine_group_test.go @@ -7,9 +7,9 @@ package integrations import ( "testing" - "xorm.io/xorm" - "xorm.io/xorm/log" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm" + "gitea.com/nikos06/xorm/log" + "gitea.com/nikos06/xorm/schemas" "github.com/stretchr/testify/assert" ) diff --git a/integrations/engine_test.go b/integrations/engine_test.go index 7f77c21f..460bacf7 100644 --- a/integrations/engine_test.go +++ b/integrations/engine_test.go @@ -11,8 +11,8 @@ import ( "testing" "time" - "xorm.io/xorm" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm" + "gitea.com/nikos06/xorm/schemas" _ "github.com/denisenkom/go-mssqldb" _ "github.com/go-sql-driver/mysql" diff --git a/integrations/processors_test.go b/integrations/processors_test.go index e349988d..e3008a24 100644 --- a/integrations/processors_test.go +++ b/integrations/processors_test.go @@ -9,7 +9,7 @@ import ( "fmt" "testing" - "xorm.io/xorm" + "gitea.com/nikos06/xorm" "github.com/stretchr/testify/assert" ) diff --git a/integrations/session_cols_test.go b/integrations/session_cols_test.go index b74c6f8a..d6db4e3f 100644 --- a/integrations/session_cols_test.go +++ b/integrations/session_cols_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "xorm.io/builder" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/schemas" ) func TestSetExpr(t *testing.T) { diff --git a/integrations/session_delete_test.go b/integrations/session_delete_test.go index f3565963..6dbbe1f7 100644 --- a/integrations/session_delete_test.go +++ b/integrations/session_delete_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "xorm.io/xorm/caches" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/caches" + "gitea.com/nikos06/xorm/schemas" "github.com/stretchr/testify/assert" ) diff --git a/integrations/session_find_test.go b/integrations/session_find_test.go index c3e99183..944f352a 100644 --- a/integrations/session_find_test.go +++ b/integrations/session_find_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/names" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/names" "github.com/stretchr/testify/assert" ) diff --git a/integrations/session_get_test.go b/integrations/session_get_test.go index e4d9f82e..9224b8a4 100644 --- a/integrations/session_get_test.go +++ b/integrations/session_get_test.go @@ -11,8 +11,8 @@ import ( "testing" "time" - "xorm.io/xorm/contexts" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/contexts" + "gitea.com/nikos06/xorm/schemas" "github.com/stretchr/testify/assert" ) diff --git a/integrations/session_insert_test.go b/integrations/session_insert_test.go index 47789b8a..baa9169f 100644 --- a/integrations/session_insert_test.go +++ b/integrations/session_insert_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "xorm.io/xorm" + "gitea.com/nikos06/xorm" "github.com/stretchr/testify/assert" ) diff --git a/integrations/session_pk_test.go b/integrations/session_pk_test.go index d5f23491..80e074c0 100644 --- a/integrations/session_pk_test.go +++ b/integrations/session_pk_test.go @@ -10,7 +10,7 @@ import ( "time" "github.com/stretchr/testify/assert" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/schemas" ) type IntId struct { diff --git a/integrations/session_query_test.go b/integrations/session_query_test.go index 30f2e6ab..9bb692a0 100644 --- a/integrations/session_query_test.go +++ b/integrations/session_query_test.go @@ -11,7 +11,7 @@ import ( "time" "xorm.io/builder" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/schemas" "github.com/stretchr/testify/assert" ) diff --git a/integrations/session_schema_test.go b/integrations/session_schema_test.go index 1ef653ef..a7023538 100644 --- a/integrations/session_schema_test.go +++ b/integrations/session_schema_test.go @@ -10,7 +10,7 @@ import ( "time" "github.com/stretchr/testify/assert" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/schemas" ) func TestStoreEngine(t *testing.T) { diff --git a/integrations/session_tx_test.go b/integrations/session_tx_test.go index 4cff5610..35993017 100644 --- a/integrations/session_tx_test.go +++ b/integrations/session_tx_test.go @@ -10,8 +10,8 @@ import ( "time" "github.com/stretchr/testify/assert" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/names" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/names" ) func TestTransaction(t *testing.T) { diff --git a/integrations/session_update_test.go b/integrations/session_update_test.go index df0631c4..58d5bf4c 100644 --- a/integrations/session_update_test.go +++ b/integrations/session_update_test.go @@ -11,11 +11,11 @@ import ( "time" "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" + "gitea.com/nikos06/xorm" + "gitea.com/nikos06/xorm/internal/statements" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/names" + "gitea.com/nikos06/xorm/schemas" ) func TestUpdateMap(t *testing.T) { diff --git a/integrations/tags_test.go b/integrations/tags_test.go index f787fffe..f2196a6c 100644 --- a/integrations/tags_test.go +++ b/integrations/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" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/names" + "gitea.com/nikos06/xorm/schemas" ) type tempUser struct { diff --git a/integrations/tests.go b/integrations/tests.go index 840b1020..71e940da 100644 --- a/integrations/tests.go +++ b/integrations/tests.go @@ -12,12 +12,12 @@ import ( "strings" "testing" - "xorm.io/xorm" - "xorm.io/xorm/caches" - "xorm.io/xorm/dialects" - "xorm.io/xorm/log" - "xorm.io/xorm/names" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm" + "gitea.com/nikos06/xorm/caches" + "gitea.com/nikos06/xorm/dialects" + "gitea.com/nikos06/xorm/log" + "gitea.com/nikos06/xorm/names" + "gitea.com/nikos06/xorm/schemas" ) var ( diff --git a/integrations/time_test.go b/integrations/time_test.go index 6d8d812c..56395129 100644 --- a/integrations/time_test.go +++ b/integrations/time_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "xorm.io/xorm/internal/utils" + "gitea.com/nikos06/xorm/internal/utils" "github.com/stretchr/testify/assert" ) diff --git a/integrations/types_test.go b/integrations/types_test.go index 112308f3..c1c5d4aa 100644 --- a/integrations/types_test.go +++ b/integrations/types_test.go @@ -9,10 +9,10 @@ import ( "fmt" "testing" - "xorm.io/xorm" - "xorm.io/xorm/convert" - "xorm.io/xorm/internal/json" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm" + "gitea.com/nikos06/xorm/convert" + "gitea.com/nikos06/xorm/internal/json" + "gitea.com/nikos06/xorm/schemas" "github.com/stretchr/testify/assert" ) diff --git a/interface.go b/interface.go index 55162c8c..c63c3a71 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" + "gitea.com/nikos06/xorm/caches" + "gitea.com/nikos06/xorm/contexts" + "gitea.com/nikos06/xorm/dialects" + "gitea.com/nikos06/xorm/log" + "gitea.com/nikos06/xorm/names" + "gitea.com/nikos06/xorm/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 cb33df08..febbbdb0 100644 --- a/internal/statements/cache.go +++ b/internal/statements/cache.go @@ -8,8 +8,8 @@ import ( "fmt" "strings" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/schemas" ) func (statement *Statement) ConvertIDSQL(sqlStr string) string { diff --git a/internal/statements/column_map.go b/internal/statements/column_map.go index bb764b4e..062db969 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" + "gitea.com/nikos06/schemas" ) type columnMap []string diff --git a/internal/statements/expr_param.go b/internal/statements/expr_param.go index 6657408e..e6a5b07b 100644 --- a/internal/statements/expr_param.go +++ b/internal/statements/expr_param.go @@ -9,7 +9,7 @@ import ( "strings" "xorm.io/builder" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/schemas" ) type ErrUnsupportedExprType struct { diff --git a/internal/statements/insert.go b/internal/statements/insert.go index 6cbbbeda..11907192 100644 --- a/internal/statements/insert.go +++ b/internal/statements/insert.go @@ -9,7 +9,7 @@ import ( "strings" "xorm.io/builder" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/schemas" ) func (statement *Statement) writeInsertOutput(buf *strings.Builder, table *schemas.Table) error { diff --git a/internal/statements/pk.go b/internal/statements/pk.go index 59da89c0..d6f2a1b8 100644 --- a/internal/statements/pk.go +++ b/internal/statements/pk.go @@ -9,7 +9,7 @@ import ( "reflect" "xorm.io/builder" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/schemas" ) var ( diff --git a/internal/statements/query.go b/internal/statements/query.go index ab3021bf..964579d6 100644 --- a/internal/statements/query.go +++ b/internal/statements/query.go @@ -11,7 +11,7 @@ import ( "strings" "xorm.io/builder" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/schemas" ) func (statement *Statement) GenQuerySQL(sqlOrArgs ...interface{}) (string, []interface{}, error) { diff --git a/internal/statements/statement.go b/internal/statements/statement.go index a4294bec..b2989429 100644 --- a/internal/statements/statement.go +++ b/internal/statements/statement.go @@ -13,13 +13,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" + "gitea.com/nikos06/xorm/contexts" + "gitea.com/nikos06/xorm/convert" + "gitea.com/nikos06/xorm/dialects" + "gitea.com/nikos06/xorm/internal/json" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/schemas" + "gitea.com/nikos06/xorm/tags" ) var ( diff --git a/internal/statements/statement_args.go b/internal/statements/statement_args.go index dc14467d..8e8d28db 100644 --- a/internal/statements/statement_args.go +++ b/internal/statements/statement_args.go @@ -11,7 +11,7 @@ import ( "time" "xorm.io/builder" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/schemas" ) func quoteNeeded(a interface{}) bool { diff --git a/internal/statements/statement_test.go b/internal/statements/statement_test.go index 15f446f4..061af24d 100644 --- a/internal/statements/statement_test.go +++ b/internal/statements/statement_test.go @@ -11,11 +11,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" + "gitea.com/nikos06/xorm/caches" + "gitea.com/nikos06/xorm/dialects" + "gitea.com/nikos06/xorm/names" + "gitea.com/nikos06/xorm/schemas" + "gitea.com/nikos06/xorm/tags" _ "github.com/mattn/go-sqlite3" ) diff --git a/internal/statements/update.go b/internal/statements/update.go index 251880b2..41fd6a01 100644 --- a/internal/statements/update.go +++ b/internal/statements/update.go @@ -11,11 +11,11 @@ import ( "reflect" "time" - "xorm.io/xorm/convert" - "xorm.io/xorm/dialects" - "xorm.io/xorm/internal/json" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/convert" + "gitea.com/nikos06/xorm/dialects" + "gitea.com/nikos06/xorm/internal/json" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/schemas" ) func (statement *Statement) ifAddColUpdate(col *schemas.Column, includeVersion, includeUpdated, includeNil, diff --git a/internal/statements/values.go b/internal/statements/values.go index 71327c55..a96293a6 100644 --- a/internal/statements/values.go +++ b/internal/statements/values.go @@ -11,10 +11,10 @@ import ( "reflect" "time" - "xorm.io/xorm/convert" - "xorm.io/xorm/dialects" - "xorm.io/xorm/internal/json" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/convert" + "gitea.com/nikos06/xorm/dialects" + "gitea.com/nikos06/xorm/internal/json" + "gitea.com/nikos06/xorm/schemas" ) var ( diff --git a/log/logger_context.go b/log/logger_context.go index 46802576..c21aa8a2 100644 --- a/log/logger_context.go +++ b/log/logger_context.go @@ -7,7 +7,7 @@ package log import ( "fmt" - "xorm.io/xorm/contexts" + "gitea.com/nikos06/xorm/contexts" ) // LogContext represents a log context diff --git a/migrate/migrate.go b/migrate/migrate.go index 82c58f90..5494e260 100644 --- a/migrate/migrate.go +++ b/migrate/migrate.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" - "xorm.io/xorm" + "gitea.com/nikos06/xorm" ) // MigrateFunc is the func signature for migrating. diff --git a/migrate/migrate_test.go b/migrate/migrate_test.go index 19554f7e..6e466d38 100644 --- a/migrate/migrate_test.go +++ b/migrate/migrate_test.go @@ -8,7 +8,7 @@ import ( _ "github.com/mattn/go-sqlite3" "github.com/stretchr/testify/assert" - "xorm.io/xorm" + "gitea.com/nikos06/xorm" ) type Person struct { diff --git a/rows.go b/rows.go index a56ea1c9..ea182ecd 100644 --- a/rows.go +++ b/rows.go @@ -11,8 +11,8 @@ import ( "reflect" "xorm.io/builder" - "xorm.io/xorm/core" - "xorm.io/xorm/internal/utils" + "gitea.com/nikos06/xorm/core" + "gitea.com/nikos06/xorm/internal/utils" ) // Rows rows wrapper a rows to diff --git a/schemas/index.go b/schemas/index.go index 9541250f..a747812e 100644 --- a/schemas/index.go +++ b/schemas/index.go @@ -5,6 +5,7 @@ package schemas import ( + "crypto/sha1" "fmt" "strings" ) @@ -31,14 +32,12 @@ func NewIndex(name string, indexType int) *Index { func (index *Index) XName(tableName string) string { if !strings.HasPrefix(index.Name, "UQE_") && !strings.HasPrefix(index.Name, "IDX_") { - tableParts := strings.Split(strings.Replace(tableName, `"`, "", -1), ".") - tableName = tableParts[len(tableParts)-1] if index.Type == UniqueType { - return fmt.Sprintf("UQE_%v_%v", tableName, index.Name) + return fmt.Sprintf("UQE_%x", sha1.Sum([]byte(tableName+index.Name))) } - return fmt.Sprintf("IDX_%v_%v", tableName, index.Name) + return fmt.Sprintf("IDX_%x", sha1.Sum([]byte(tableName+index.Name))) } - return index.Name + return fmt.Sprintf("%x", sha1.Sum([]byte(tableName+index.Name))) } // AddColumn add columns which will be composite index diff --git a/schemas/pk.go b/schemas/pk.go index 03916b44..458bdb4c 100644 --- a/schemas/pk.go +++ b/schemas/pk.go @@ -8,7 +8,7 @@ import ( "bytes" "encoding/gob" - "xorm.io/xorm/internal/utils" + "gitea.com/nikos06/xorm/internal/utils" ) type PK []interface{} diff --git a/schemas/table.go b/schemas/table.go index 7ca9531f..1fda5e4d 100644 --- a/schemas/table.go +++ b/schemas/table.go @@ -14,6 +14,7 @@ import ( // Table represents a database table type Table struct { Name string + ObjectId string Type reflect.Type columnsSeq []string columnsMap map[string][]*Column diff --git a/schemas/type.go b/schemas/type.go index f0ede296..754b5aae 100644 --- a/schemas/type.go +++ b/schemas/type.go @@ -100,6 +100,7 @@ var ( Date = "DATE" DateTime = "DATETIME" + DateTime2 = "DATETIME2" SmallDateTime = "SMALLDATETIME" Time = "TIME" TimeStamp = "TIMESTAMP" @@ -166,6 +167,7 @@ var ( Date: TIME_TYPE, DateTime: TIME_TYPE, + DateTime2: TIME_TYPE, Time: TIME_TYPE, TimeStamp: TIME_TYPE, TimeStampz: TIME_TYPE, @@ -333,7 +335,7 @@ func SQLType2Type(st SQLType) reflect.Type { return reflect.TypeOf([]byte{}) case Bool: return reflect.TypeOf(true) - case DateTime, Date, Time, TimeStamp, TimeStampz, SmallDateTime, Year: + case DateTime, DateTime2, Date, Time, TimeStamp, TimeStampz, SmallDateTime, Year: return reflect.TypeOf(c_TIME_DEFAULT) case Decimal, Numeric, Money, SmallMoney: return reflect.TypeOf("") diff --git a/session.go b/session.go index 17abd453..9a599f6c 100644 --- a/session.go +++ b/session.go @@ -18,13 +18,13 @@ import ( "strings" "time" - "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" + "gitea.com/nikos06/xorm/contexts" + "gitea.com/nikos06/xorm/convert" + "gitea.com/nikos06/xorm/core" + "gitea.com/nikos06/xorm/internal/json" + "gitea.com/nikos06/xorm/internal/statements" + "gitea.com/nikos06/xorm/log" + "gitea.com/nikos06/xorm/schemas" ) // ErrFieldIsNotExist columns does not exist diff --git a/session_cols.go b/session_cols.go index ca3589ab..53a64fe9 100644 --- a/session_cols.go +++ b/session_cols.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/schemas" ) func setColumnInt(bean interface{}, col *schemas.Column, t int64) { diff --git a/session_convert.go b/session_convert.go index a6839947..2a96e5db 100644 --- a/session_convert.go +++ b/session_convert.go @@ -13,10 +13,10 @@ import ( "strings" "time" - "xorm.io/xorm/convert" - "xorm.io/xorm/internal/json" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/convert" + "gitea.com/nikos06/xorm/internal/json" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/schemas" ) func (session *Session) str2Time(col *schemas.Column, data string) (outTime time.Time, outErr error) { diff --git a/session_delete.go b/session_delete.go index 13bf791f..f329a6a9 100644 --- a/session_delete.go +++ b/session_delete.go @@ -9,8 +9,8 @@ import ( "fmt" "strconv" - "xorm.io/xorm/caches" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/caches" + "gitea.com/nikos06/xorm/schemas" ) var ( diff --git a/session_find.go b/session_find.go index 0daea005..a06e57e8 100644 --- a/session_find.go +++ b/session_find.go @@ -10,10 +10,10 @@ import ( "reflect" "xorm.io/builder" - "xorm.io/xorm/caches" - "xorm.io/xorm/internal/statements" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/caches" + "gitea.com/nikos06/xorm/internal/statements" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/schemas" ) const ( diff --git a/session_get.go b/session_get.go index afedcd1f..402cf5ab 100644 --- a/session_get.go +++ b/session_get.go @@ -11,9 +11,9 @@ import ( "reflect" "strconv" - "xorm.io/xorm/caches" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/caches" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/schemas" ) // Get retrieve one record from database, bean's non-empty fields diff --git a/session_insert.go b/session_insert.go index 5f968151..96e42c41 100644 --- a/session_insert.go +++ b/session_insert.go @@ -12,8 +12,8 @@ import ( "strconv" "strings" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/schemas" ) // ErrNoElementsOnSlice represents an error there is no element when insert diff --git a/session_iterate.go b/session_iterate.go index 8cab8f48..e485854e 100644 --- a/session_iterate.go +++ b/session_iterate.go @@ -7,7 +7,7 @@ package xorm import ( "reflect" - "xorm.io/xorm/internal/utils" + "gitea.com/nikos06/xorm/internal/utils" ) // IterFunc only use by Iterate diff --git a/session_query.go b/session_query.go index 12136466..d456ef41 100644 --- a/session_query.go +++ b/session_query.go @@ -10,8 +10,8 @@ import ( "strconv" "time" - "xorm.io/xorm/core" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/core" + "gitea.com/nikos06/xorm/schemas" ) // Query runs a raw sql and return records as []map[string][]byte diff --git a/session_raw.go b/session_raw.go index 4cfe297a..978be8a2 100644 --- a/session_raw.go +++ b/session_raw.go @@ -8,7 +8,7 @@ import ( "database/sql" "reflect" - "xorm.io/xorm/core" + "gitea.com/nikos06/xorm/core" ) func (session *Session) queryPreprocess(sqlStr *string, paramStr ...interface{}) { diff --git a/session_schema.go b/session_schema.go index 9ccf8abe..53fd1cc7 100644 --- a/session_schema.go +++ b/session_schema.go @@ -12,8 +12,8 @@ import ( "os" "strings" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/schemas" ) // Ping test if database is ok diff --git a/session_update.go b/session_update.go index 0adac25e..b98e0649 100644 --- a/session_update.go +++ b/session_update.go @@ -12,9 +12,9 @@ import ( "strings" "xorm.io/builder" - "xorm.io/xorm/caches" - "xorm.io/xorm/internal/utils" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/caches" + "gitea.com/nikos06/xorm/internal/utils" + "gitea.com/nikos06/xorm/schemas" ) func (session *Session) cacheUpdate(table *schemas.Table, tableName, sqlStr string, args ...interface{}) error { diff --git a/tags/parser.go b/tags/parser.go index 45dd6d9d..b524e706 100644 --- a/tags/parser.go +++ b/tags/parser.go @@ -13,11 +13,11 @@ import ( "sync" "time" - "xorm.io/xorm/caches" - "xorm.io/xorm/convert" - "xorm.io/xorm/dialects" - "xorm.io/xorm/names" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/caches" + "gitea.com/nikos06/xorm/convert" + "gitea.com/nikos06/xorm/dialects" + "gitea.com/nikos06/xorm/names" + "gitea.com/nikos06/xorm/schemas" ) var ( diff --git a/tags/parser_test.go b/tags/parser_test.go index c3bf8051..5510cef0 100644 --- a/tags/parser_test.go +++ b/tags/parser_test.go @@ -9,9 +9,9 @@ import ( "testing" "github.com/stretchr/testify/assert" - "xorm.io/xorm/caches" - "xorm.io/xorm/dialects" - "xorm.io/xorm/names" + "gitea.com/nikos06/xorm/caches" + "gitea.com/nikos06/xorm/dialects" + "gitea.com/nikos06/xorm/names" ) type ParseTableName1 struct{} diff --git a/tags/tag.go b/tags/tag.go index bb5b5838..077f0e85 100644 --- a/tags/tag.go +++ b/tags/tag.go @@ -11,7 +11,7 @@ import ( "strings" "time" - "xorm.io/xorm/schemas" + "gitea.com/nikos06/xorm/schemas" ) func splitTag(tag string) (tags []string) { diff --git a/tags/tag_test.go b/tags/tag_test.go index 5775b40a..fe0f2e8f 100644 --- a/tags/tag_test.go +++ b/tags/tag_test.go @@ -7,7 +7,7 @@ package tags import ( "testing" - "xorm.io/xorm/internal/utils" + "gitea.com/nikos06/xorm/internal/utils" ) func TestSplitTag(t *testing.T) {