parent
3b4c1be57a
commit
82faf6c301
2
Makefile
2
Makefile
|
@ -9,7 +9,7 @@ SED_INPLACE := sed -i
|
|||
GO_DIRS := caches contexts integrations core dialects internal log migrate names schemas tags
|
||||
GOFILES := $(wildcard *.go)
|
||||
GOFILES += $(shell find $(GO_DIRS) -name "*.go" -type f)
|
||||
INTEGRATION_PACKAGES := xorm.io/xorm/tests
|
||||
INTEGRATION_PACKAGES := xorm.io/xorm/v2/tests
|
||||
PACKAGES ?= $(filter-out $(INTEGRATION_PACKAGES),$(shell $(GO) list ./...))
|
||||
|
||||
TEST_COCKROACH_HOST ?= cockroach:26257
|
||||
|
|
16
README.md
16
README.md
|
@ -56,13 +56,13 @@ Drivers for Go's sql package which currently support database/sql includes:
|
|||
|
||||
## Installation
|
||||
|
||||
go get xorm.io/xorm
|
||||
go get xorm.io/xorm/v2
|
||||
|
||||
## Documents
|
||||
|
||||
* [Manual](http://xorm.io/docs)
|
||||
|
||||
* [GoDoc](http://pkg.go.dev/xorm.io/xorm)
|
||||
* [GoDoc](http://pkg.go.dev/xorm.io/xorm/v2)
|
||||
|
||||
## Quick Start
|
||||
|
||||
|
@ -489,20 +489,18 @@ You can find all the changelog [here](CHANGELOG.md)
|
|||
|
||||
## Cases
|
||||
|
||||
* [studygolang](http://studygolang.com/) - [github.com/studygolang/studygolang](https://github.com/studygolang/studygolang)
|
||||
|
||||
* [Gitea](http://gitea.io) - [github.com/go-gitea/gitea](http://github.com/go-gitea/gitea)
|
||||
|
||||
* [Gogs](http://try.gogits.org) - [github.com/gogits/gogs](http://github.com/gogits/gogs)
|
||||
* [Gitea](http://about.gitea.com) - [github.com/go-gitea/gitea](http://github.com/go-gitea/gitea)
|
||||
|
||||
* [grafana](https://grafana.com/) - [github.com/grafana/grafana](http://github.com/grafana/grafana)
|
||||
|
||||
* [studygolang](http://studygolang.com/) - [github.com/studygolang/studygolang](https://github.com/studygolang/studygolang)
|
||||
|
||||
* [Gogs](http://try.gogits.org) - [github.com/gogits/gogs](http://github.com/gogits/gogs)
|
||||
|
||||
* [github.com/m3ng9i/qreader](https://github.com/m3ng9i/qreader)
|
||||
|
||||
* [Wego](http://github.com/go-tango/wego)
|
||||
|
||||
* [Docker.cn](https://docker.cn/)
|
||||
|
||||
* [Xorm Adapter](https://github.com/casbin/xorm-adapter) for [Casbin](https://github.com/casbin/casbin) - [github.com/casbin/xorm-adapter](https://github.com/casbin/xorm-adapter)
|
||||
|
||||
* [Gorevel](http://gorevel.cn/) - [github.com/goofcc/gorevel](http://github.com/goofcc/gorevel)
|
||||
|
|
|
@ -55,13 +55,13 @@ v1.0.0 相对于 v0.8.2 有以下不兼容的变更:
|
|||
|
||||
## 安装
|
||||
|
||||
go get xorm.io/xorm
|
||||
go get xorm.io/xorm/v2
|
||||
|
||||
## 文档
|
||||
|
||||
* [操作指南](http://xorm.io/docs)
|
||||
|
||||
* [Godoc代码文档](http://pkg.go.dev/xorm.io/xorm)
|
||||
* [Godoc代码文档](http://pkg.go.dev/xorm.io/xorm/v2)
|
||||
|
||||
# 快速开始
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
20
core/db.go
20
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 (?)
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"errors"
|
||||
"reflect"
|
||||
|
||||
"xorm.io/xorm/contexts"
|
||||
"xorm.io/xorm/v2/contexts"
|
||||
)
|
||||
|
||||
// Stmt reprents a stmt objects
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -7,7 +7,7 @@ package dialects
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"xorm.io/xorm/names"
|
||||
"xorm.io/xorm/v2/names"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
)
|
||||
|
||||
// FormatColumnTime format column time
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
)
|
||||
|
||||
type dialect struct {
|
||||
|
|
18
engine.go
18
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.
|
||||
|
|
|
@ -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
|
||||
|
|
43
go.mod
43
go.mod
|
@ -1,13 +1,12 @@
|
|||
module xorm.io/xorm
|
||||
module xorm.io/xorm/v2
|
||||
|
||||
go 1.16
|
||||
go 1.20
|
||||
|
||||
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
|
||||
|
@ -17,4 +16,42 @@ require (
|
|||
github.com/syndtr/goleveldb v1.0.0
|
||||
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
|
||||
)
|
||||
|
|
5
go.sum
5
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=
|
||||
|
@ -181,6 +179,7 @@ github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpP
|
|||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
||||
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
|
||||
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
|
@ -341,3 +340,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=
|
||||
|
|
12
interface.go
12
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.
|
||||
|
|
|
@ -6,7 +6,7 @@ package statements
|
|||
|
||||
import (
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
)
|
||||
|
||||
// WriteArg writes an arg
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -7,7 +7,7 @@ package statements
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
)
|
||||
|
||||
type columnMap []string
|
||||
|
|
|
@ -6,7 +6,7 @@ package statements
|
|||
|
||||
import (
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
)
|
||||
|
||||
type QuoteReplacer struct {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -9,8 +9,8 @@ import (
|
|||
"fmt"
|
||||
|
||||
"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) writePagination(bw *builder.BytesWriter) error {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
)
|
||||
|
||||
// GenQuerySQL generate query SQL
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
)
|
||||
|
||||
// Select replace select
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
)
|
||||
|
||||
// TableName return current tableName
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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 (
|
||||
|
|
2
rows.go
2
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
|
||||
|
|
8
scan.go
8
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
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"bytes"
|
||||
"encoding/gob"
|
||||
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/v2/internal/utils"
|
||||
)
|
||||
|
||||
// PK represents primary key values
|
||||
|
|
15
session.go
15
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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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{}) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
4
sync.go
4
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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
)
|
||||
|
||||
type tag struct {
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/caches"
|
||||
"xorm.io/xorm/v2/caches"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
package tests
|
||||
|
||||
import "xorm.io/xorm/schemas"
|
||||
import "xorm.io/xorm/v2/schemas"
|
||||
|
||||
func init() {
|
||||
dbtypes = append(dbtypes, schemas.DAMENG)
|
||||
|
|
|
@ -7,9 +7,9 @@ package tests
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/log"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2"
|
||||
"xorm.io/xorm/v2/log"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -11,8 +11,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
|
||||
_ "gitee.com/travelliu/dm"
|
||||
_ "github.com/denisenkom/go-mssqldb"
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/v2"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -11,9 +11,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/v2"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
func TestStoreEngine(t *testing.T) {
|
||||
|
@ -716,7 +717,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 {
|
||||
|
|
|
@ -7,9 +7,10 @@ package tests
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestSetExpr(t *testing.T) {
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -9,10 +9,10 @@ import (
|
|||
"time"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/names"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2"
|
||||
"xorm.io/xorm/v2/internal/utils"
|
||||
"xorm.io/xorm/v2/names"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -12,11 +12,11 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/contexts"
|
||||
"xorm.io/xorm/convert"
|
||||
"xorm.io/xorm/dialects"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2"
|
||||
"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"
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
)
|
||||
|
||||
type IntId struct {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/convert"
|
||||
"xorm.io/xorm/v2/convert"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -10,12 +10,13 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/v2"
|
||||
"xorm.io/xorm/v2/internal/statements"
|
||||
"xorm.io/xorm/v2/internal/utils"
|
||||
"xorm.io/xorm/v2/names"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
|
||||
"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"
|
||||
)
|
||||
|
||||
func TestUpdateMap(t *testing.T) {
|
||||
|
|
|
@ -11,10 +11,11 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/v2/internal/utils"
|
||||
"xorm.io/xorm/v2/names"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/names"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
type tempUser struct {
|
||||
|
|
|
@ -13,12 +13,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"
|
||||
"xorm.io/xorm/v2"
|
||||
"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 (
|
||||
|
|
|
@ -11,9 +11,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/convert"
|
||||
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/v2/convert"
|
||||
"xorm.io/xorm/v2/internal/utils"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
|
@ -12,10 +12,10 @@ import (
|
|||
"strconv"
|
||||
"testing"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/convert"
|
||||
"xorm.io/xorm/internal/json"
|
||||
"xorm.io/xorm/schemas"
|
||||
"xorm.io/xorm/v2"
|
||||
"xorm.io/xorm/v2/convert"
|
||||
"xorm.io/xorm/v2/internal/json"
|
||||
"xorm.io/xorm/v2/schemas"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue