Compare commits
33 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
5ed154f8c5 | |
|
|
8f5e437a61 | |
|
|
b72e98f60e | |
|
|
89d1238248 | |
|
|
f50aacd38b | |
|
|
3b3f99f8a1 | |
|
|
cc4be22330 | |
|
|
cd0ca0bbc6 | |
|
|
844543c7da | |
|
|
7654b7b749 | |
|
|
d47f35b260 | |
|
|
cbbd1f09e1 | |
|
|
c6d05fa553 | |
|
|
3bc2ea24f6 | |
|
|
4e74c80b67 | |
|
|
8094e98a8f | |
|
|
589acfff86 | |
|
|
34e62e9b4c | |
|
|
be77a7084b | |
|
|
7a535a7899 | |
|
|
2e2a66c640 | |
|
|
63222312b2 | |
|
|
0c9a2f6a70 | |
|
|
11e96d9654 | |
|
|
5301cc0ae9 | |
|
|
e884f059a4 | |
|
|
ac3be4148e | |
|
|
70c6978fc4 | |
|
|
83fdc38834 | |
|
|
a901ab8593 | |
|
|
4992cba040 | |
|
|
6ce46e7fac | |
|
|
5d57ef92f5 |
|
|
@ -9,13 +9,13 @@ jobs:
|
|||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: setup go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '>=1.20.1'
|
||||
go-version-file: 'go.mod'
|
||||
- name: Use Go Action
|
||||
id: use-go-action
|
||||
uses: https://gitea.com/actions/release-action@main
|
||||
|
|
|
|||
|
|
@ -1,42 +1,21 @@
|
|||
name: test cockroach
|
||||
on:
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
GOPATH: /go_path
|
||||
GOCACHE: /go_cache
|
||||
- donttrigger # disabled for now
|
||||
#- main
|
||||
#- v1
|
||||
#pull_request:
|
||||
|
||||
jobs:
|
||||
test-cockroach:
|
||||
name: test cockroach
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# - name: cache go path
|
||||
# id: cache-go-path
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_path
|
||||
# key: go_path-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_path-${{ github.repository }}-
|
||||
# go_path-
|
||||
# - name: cache go cache
|
||||
# id: cache-go-cache
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_cache
|
||||
# key: go_cache-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_cache-${{ github.repository }}-
|
||||
# go_cache-
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.20
|
||||
- uses: actions/checkout@v3
|
||||
go-version-file: 'go.mod'
|
||||
- name: test cockroach
|
||||
env:
|
||||
TEST_COCKROACH_HOST: "cockroach:26257"
|
||||
|
|
@ -49,8 +28,6 @@ jobs:
|
|||
services:
|
||||
cockroach:
|
||||
image: cockroachdb/cockroach:v19.2.4
|
||||
ports:
|
||||
- 26257:26257
|
||||
cmd:
|
||||
- 'start'
|
||||
- '--insecure'
|
||||
|
|
|
|||
|
|
@ -2,41 +2,19 @@ name: test mariadb
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
GOPATH: /go_path
|
||||
GOCACHE: /go_cache
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: test mariadb
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# - name: cache go path
|
||||
# id: cache-go-path
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_path
|
||||
# key: go_path-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_path-${{ github.repository }}-
|
||||
# go_path-
|
||||
# - name: cache go cache
|
||||
# id: cache-go-cache
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_cache
|
||||
# key: go_cache-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_cache-${{ github.repository }}-
|
||||
# go_cache-
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.20
|
||||
- uses: actions/checkout@v3
|
||||
go-version-file: 'go.mod'
|
||||
- name: test mariadb
|
||||
env:
|
||||
TEST_MYSQL_HOST: mariadb
|
||||
|
|
@ -51,6 +29,4 @@ jobs:
|
|||
image: mariadb:10.4
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
||||
MYSQL_DATABASE: xorm_test
|
||||
ports:
|
||||
- 3306:3306
|
||||
MYSQL_DATABASE: xorm_test
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
name: test mssql
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test-mssql-collation:
|
||||
name: test mssql with collation
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
- name: test mssql with collation
|
||||
env:
|
||||
TEST_MSSQL_HOST: mssql2
|
||||
TEST_MSSQL_DBNAME: xorm_test
|
||||
TEST_MSSQL_USERNAME: sa
|
||||
TEST_MSSQL_PASSWORD: "yourStrong(!)Password"
|
||||
TEST_MSSQL_COLLATION: SQL_Latin1_General_CP1_CS_AS
|
||||
run: TEST_MSSQL_DEFAULT_VARCHAR=NVARCHAR TEST_MSSQL_DEFAULT_CHAR=NCHAR make test-mssql
|
||||
|
||||
services:
|
||||
mssql2:
|
||||
image: mcr.microsoft.com/mssql/server:latest
|
||||
env:
|
||||
ACCEPT_EULA: Y
|
||||
SA_PASSWORD: yourStrong(!)Password
|
||||
MSSQL_PID: Standard
|
||||
|
|
@ -2,41 +2,19 @@ name: test mssql
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
GOPATH: /go_path
|
||||
GOCACHE: /go_cache
|
||||
|
||||
jobs:
|
||||
test-mssql:
|
||||
name: test mssql
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# - name: cache go path
|
||||
# id: cache-go-path
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_path
|
||||
# key: go_path-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_path-${{ github.repository }}-
|
||||
# go_path-
|
||||
# - name: cache go cache
|
||||
# id: cache-go-cache
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_cache
|
||||
# key: go_cache-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_cache-${{ github.repository }}-
|
||||
# go_cache-
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.20
|
||||
- uses: actions/checkout@v3
|
||||
go-version-file: 'go.mod'
|
||||
- name: test mssql
|
||||
env:
|
||||
TEST_MSSQL_HOST: mssql
|
||||
|
|
@ -51,6 +29,4 @@ jobs:
|
|||
env:
|
||||
ACCEPT_EULA: Y
|
||||
SA_PASSWORD: yourStrong(!)Password
|
||||
MSSQL_PID: Standard
|
||||
ports:
|
||||
- 1433:1433
|
||||
MSSQL_PID: Standard
|
||||
|
|
@ -2,41 +2,19 @@ name: test mysql
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
GOPATH: /go_path
|
||||
GOCACHE: /go_cache
|
||||
|
||||
jobs:
|
||||
test-mysql:
|
||||
name: test mysql
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# - name: cache go path
|
||||
# id: cache-go-path
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_path
|
||||
# key: go_path-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_path-${{ github.repository }}-
|
||||
# go_path-
|
||||
# - name: cache go cache
|
||||
# id: cache-go-cache
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_cache
|
||||
# key: go_cache-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_cache-${{ github.repository }}-
|
||||
# go_cache-
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.20
|
||||
- uses: actions/checkout@v3
|
||||
go-version-file: 'go.mod'
|
||||
- name: test mysql utf8mb4
|
||||
env:
|
||||
TEST_MYSQL_HOST: mysql
|
||||
|
|
@ -51,6 +29,4 @@ jobs:
|
|||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
||||
MYSQL_DATABASE: xorm_test
|
||||
ports:
|
||||
- 3306:3306
|
||||
MYSQL_DATABASE: xorm_test
|
||||
|
|
@ -2,41 +2,19 @@ name: test mysql8
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
GOPATH: /go_path
|
||||
GOCACHE: /go_cache
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: test mysql8
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# - name: cache go path
|
||||
# id: cache-go-path
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_path
|
||||
# key: go_path-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_path-${{ github.repository }}-
|
||||
# go_path-
|
||||
# - name: cache go cache
|
||||
# id: cache-go-cache
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_cache
|
||||
# key: go_cache-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_cache-${{ github.repository }}-
|
||||
# go_cache-
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.20
|
||||
- uses: actions/checkout@v3
|
||||
go-version-file: 'go.mod'
|
||||
- name: test mysql8
|
||||
env:
|
||||
TEST_MYSQL_HOST: mysql8
|
||||
|
|
@ -51,6 +29,4 @@ jobs:
|
|||
image: mysql:8.0
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
||||
MYSQL_DATABASE: xorm_test
|
||||
ports:
|
||||
- 3306:3306
|
||||
MYSQL_DATABASE: xorm_test
|
||||
|
|
@ -2,41 +2,19 @@ name: test postgres
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
GOPATH: /go_path
|
||||
GOCACHE: /go_cache
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: test postgres
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# - name: cache go path
|
||||
# id: cache-go-path
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_path
|
||||
# key: go_path-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_path-${{ github.repository }}-
|
||||
# go_path-
|
||||
# - name: cache go cache
|
||||
# id: cache-go-cache
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_cache
|
||||
# key: go_cache-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_cache-${{ github.repository }}-
|
||||
# go_cache-
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.20
|
||||
- uses: actions/checkout@v3
|
||||
go-version-file: 'go.mod'
|
||||
- name: test postgres
|
||||
env:
|
||||
TEST_PGSQL_HOST: pgsql
|
||||
|
|
@ -74,6 +52,4 @@ jobs:
|
|||
env:
|
||||
POSTGRES_DB: xorm_test
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
ports:
|
||||
- 5432:5432
|
||||
POSTGRES_PASSWORD: postgres
|
||||
|
|
@ -2,41 +2,19 @@ name: test sqlite
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
GOPATH: /go_path
|
||||
GOCACHE: /go_cache
|
||||
|
||||
jobs:
|
||||
test-sqlite:
|
||||
name: unit test & test sqlite
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# - name: cache go path
|
||||
# id: cache-go-path
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_path
|
||||
# key: go_path-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_path-${{ github.repository }}-
|
||||
# go_path-
|
||||
# - name: cache go cache
|
||||
# id: cache-go-cache
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_cache
|
||||
# key: go_cache-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_cache-${{ github.repository }}-
|
||||
# go_cache-
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.20
|
||||
- uses: actions/checkout@v3
|
||||
go-version-file: 'go.mod'
|
||||
- name: vet
|
||||
run: make vet
|
||||
- name: format check
|
||||
|
|
@ -46,4 +24,14 @@ jobs:
|
|||
- name: test sqlite3
|
||||
run: make test-sqlite3
|
||||
- name: test sqlite3 with cache
|
||||
run: TEST_CACHE_ENABLE=true make test-sqlite3
|
||||
run: TEST_CACHE_ENABLE=true make test-sqlite3
|
||||
|
||||
govulncheck_job:
|
||||
runs-on: ubuntu-latest
|
||||
name: Run govulncheck
|
||||
steps:
|
||||
- id: govulncheck
|
||||
uses: golang/govulncheck-action@v1
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
go-package: ./...
|
||||
|
|
@ -2,41 +2,19 @@ name: test tidb
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
GOPROXY: https://goproxy.io,direct
|
||||
GOPATH: /go_path
|
||||
GOCACHE: /go_cache
|
||||
|
||||
jobs:
|
||||
test-tidb:
|
||||
name: test tidb
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# - name: cache go path
|
||||
# id: cache-go-path
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_path
|
||||
# key: go_path-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_path-${{ github.repository }}-
|
||||
# go_path-
|
||||
# - name: cache go cache
|
||||
# id: cache-go-cache
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: /go_cache
|
||||
# key: go_cache-${{ github.repository }}-${{ github.ref_name }}
|
||||
# restore-keys: |
|
||||
# go_cache-${{ github.repository }}-
|
||||
# go_cache-
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.20
|
||||
- uses: actions/checkout@v3
|
||||
go-version-file: 'go.mod'
|
||||
- name: test tidb
|
||||
env:
|
||||
TEST_TIDB_HOST: "tidb:4000"
|
||||
|
|
@ -47,6 +25,4 @@ jobs:
|
|||
|
||||
services:
|
||||
tidb:
|
||||
image: pingcap/tidb:v3.0.3
|
||||
ports:
|
||||
- 4000:4000
|
||||
image: pingcap/tidb:v3.0.3
|
||||
2
Makefile
2
Makefile
|
|
@ -25,6 +25,7 @@ TEST_MSSQL_PASSWORD ?= MwantsaSecurePassword1
|
|||
TEST_MSSQL_DEFAULT_VARCHAR ?= varchar
|
||||
TEST_MSSQL_DEFAULT_CHAR ?= char
|
||||
TEST_MSSQL_DO_NVARCHAR_OVERRIDE_TEST ?= true
|
||||
TEST_MSSQL_COLLATION ?=
|
||||
|
||||
TEST_MYSQL_HOST ?= mysql:3306
|
||||
TEST_MYSQL_CHARSET ?= utf8
|
||||
|
|
@ -153,6 +154,7 @@ test-mssql: go-check
|
|||
-conn_str="server=$(TEST_MSSQL_HOST);user id=$(TEST_MSSQL_USERNAME);password=$(TEST_MSSQL_PASSWORD);database=$(TEST_MSSQL_DBNAME)" \
|
||||
-default_varchar=$(TEST_MSSQL_DEFAULT_VARCHAR) -default_char=$(TEST_MSSQL_DEFAULT_CHAR) \
|
||||
-do_nvarchar_override_test=$(TEST_MSSQL_DO_NVARCHAR_OVERRIDE_TEST) \
|
||||
-collation=$(TEST_MSSQL_COLLATION) \
|
||||
-coverprofile=mssql.$(TEST_QUOTE_POLICY).$(TEST_CACHE_ENABLE).coverage.out -covermode=atomic -timeout=20m
|
||||
|
||||
.PNONY: test-mssql\#%
|
||||
|
|
|
|||
11
README.md
11
README.md
|
|
@ -1,10 +1,10 @@
|
|||
# xorm
|
||||
|
||||
[中文](https://gitea.com/xorm/xorm/src/branch/master/README_CN.md)
|
||||
[中文](https://gitea.com/xorm/xorm/src/branch/v1/README_CN.md)
|
||||
|
||||
Xorm is a simple and powerful ORM for Go.
|
||||
|
||||
[](https://drone.gitea.com/xorm/xorm) [](https://gocover.io/xorm.io/xorm) [](https://goreportcard.com/report/xorm.io/xorm) [](https://discord.gg/HuR2CF3)
|
||||
[](https://gitea.com/xorm/xorm/actions) [](https://gocover.io/xorm.io/xorm) [](https://goreportcard.com/report/xorm.io/xorm) [](https://discord.gg/HuR2CF3)
|
||||
|
||||
## Notice
|
||||
|
||||
|
|
@ -48,7 +48,10 @@ Drivers for Go's sql package which currently support database/sql includes:
|
|||
- [modernc.org/sqlite](https://gitlab.com/cznic/sqlite)
|
||||
|
||||
* MsSql
|
||||
- [github.com/denisenkom/go-mssqldb](https://github.com/denisenkom/go-mssqldb)
|
||||
- [github.com/microsoft/go-mssqldb](https://github.com/microsoft/go-mssqldb)
|
||||
|
||||
* GBase8s
|
||||
- [https://gitee.com/GBase8s/go-gci](https://gitee.com/GBase8s/go-gci)
|
||||
|
||||
* Oracle
|
||||
- [github.com/godror/godror](https://github.com/godror/godror) (experiment)
|
||||
|
|
@ -465,7 +468,7 @@ res, err := engine.Transaction(func(session *xorm.Session) (interface{}, error)
|
|||
|
||||
## Contributing
|
||||
|
||||
If you want to pull request, please see [CONTRIBUTING](https://gitea.com/xorm/xorm/src/branch/master/CONTRIBUTING.md). And you can also go to [Xorm on discourse](https://xorm.discourse.group) to discuss.
|
||||
If you want to pull request, please see [CONTRIBUTING](CONTRIBUTING.md). And you can also go to [Xorm on discourse](https://xorm.discourse.group) to discuss.
|
||||
|
||||
## Credits
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# xorm
|
||||
|
||||
[English](https://gitea.com/xorm/xorm/src/branch/master/README.md)
|
||||
[English](https://gitea.com/xorm/xorm/src/branch/v1/README.md)
|
||||
|
||||
xorm 是一个简单而强大的Go语言ORM库. 通过它可以使数据库操作非常简便。
|
||||
|
||||
|
|
@ -47,7 +47,10 @@ v1.0.0 相对于 v0.8.2 有以下不兼容的变更:
|
|||
- [modernc.org/sqlite](https://gitlab.com/cznic/sqlite)
|
||||
|
||||
* MsSql
|
||||
- [github.com/denisenkom/go-mssqldb](https://github.com/denisenkom/go-mssqldb)
|
||||
- [github.com/microsoft/go-mssqldb](https://github.com/microsoft/go-mssqldb)
|
||||
|
||||
* GBase8s
|
||||
- [https://gitee.com/GBase8s/go-gci](https://gitee.com/GBase8s/go-gci)
|
||||
|
||||
* Oracle
|
||||
- [github.com/godror/godror](https://github.com/godror/godror) (试验性支持)
|
||||
|
|
|
|||
|
|
@ -28,14 +28,19 @@ func String2Time(s string, originalLocation *time.Location, convertedLocation *t
|
|||
dt = dt.In(convertedLocation)
|
||||
return &dt, nil
|
||||
} else if len(s) == 20 && s[10] == 'T' && s[19] == 'Z' {
|
||||
if strings.HasPrefix(s, "0000-00-00T00:00:00") || strings.HasPrefix(s, "0001-01-01T00:00:00") {
|
||||
return &time.Time{}, nil
|
||||
}
|
||||
dt, err := time.ParseInLocation("2006-01-02T15:04:05", s[:19], originalLocation)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dt = dt.In(convertedLocation)
|
||||
dt.IsZero()
|
||||
return &dt, nil
|
||||
} else if len(s) == 25 && s[10] == 'T' && s[19] == '+' && s[22] == ':' {
|
||||
if strings.HasPrefix(s, "0000-00-00T00:00:00") || strings.HasPrefix(s, "0001-01-01T00:00:00") {
|
||||
return &time.Time{}, nil
|
||||
}
|
||||
dt, err := time.Parse(time.RFC3339, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -43,6 +48,10 @@ func String2Time(s string, originalLocation *time.Location, convertedLocation *t
|
|||
dt = dt.In(convertedLocation)
|
||||
return &dt, nil
|
||||
} else if len(s) >= 21 && s[10] == 'T' && s[19] == '.' {
|
||||
if strings.HasPrefix(s, "0000-00-00T00:00:00."+strings.Repeat("0", len(s)-20)) ||
|
||||
strings.HasPrefix(s, "0001-01-01T00:00:00."+strings.Repeat("0", len(s)-20)) {
|
||||
return &time.Time{}, nil
|
||||
}
|
||||
dt, err := time.Parse(time.RFC3339Nano, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -50,6 +59,10 @@ func String2Time(s string, originalLocation *time.Location, convertedLocation *t
|
|||
dt = dt.In(convertedLocation)
|
||||
return &dt, nil
|
||||
} else if len(s) >= 21 && s[19] == '.' {
|
||||
if strings.HasPrefix(s, "0000-00-00T00:00:00."+strings.Repeat("0", len(s)-20)) ||
|
||||
strings.HasPrefix(s, "0001-01-01T00:00:00."+strings.Repeat("0", len(s)-20)) {
|
||||
return &time.Time{}, nil
|
||||
}
|
||||
layout := "2006-01-02 15:04:05." + strings.Repeat("0", len(s)-20)
|
||||
dt, err := time.ParseInLocation(layout, s, originalLocation)
|
||||
if err != nil {
|
||||
|
|
@ -68,20 +81,20 @@ func String2Time(s string, originalLocation *time.Location, convertedLocation *t
|
|||
dt = dt.In(convertedLocation)
|
||||
return &dt, nil
|
||||
} else if len(s) == 8 && s[2] == ':' && s[5] == ':' {
|
||||
currentDate := time.Now()
|
||||
dt, err := time.ParseInLocation("15:04:05", s, originalLocation)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// add current date for correct time locations
|
||||
dt = dt.AddDate(currentDate.Year(), int(currentDate.Month()), currentDate.Day())
|
||||
dt = dt.In(convertedLocation)
|
||||
dt = dt.AddDate(2006, 01, 02).In(convertedLocation)
|
||||
// back to zero year
|
||||
dt = dt.AddDate(-currentDate.Year(), int(-currentDate.Month()), -currentDate.Day())
|
||||
dt = dt.AddDate(-2006, -01, -02)
|
||||
return &dt, nil
|
||||
} else {
|
||||
i, err := strconv.ParseInt(s, 10, 64)
|
||||
if err == nil {
|
||||
if i == 0 {
|
||||
return &time.Time{}, nil
|
||||
}
|
||||
tm := time.Unix(i, 0).In(convertedLocation)
|
||||
return &tm, nil
|
||||
}
|
||||
|
|
@ -108,6 +121,9 @@ func AsTime(src interface{}, dbLoc *time.Location, uiLoc *time.Location) (*time.
|
|||
if !t.Valid {
|
||||
return nil, nil
|
||||
}
|
||||
if utils.IsTimeZero(t.Time) {
|
||||
return &time.Time{}, nil
|
||||
}
|
||||
z, _ := t.Time.Zone()
|
||||
if len(z) == 0 || t.Time.Year() == 0 || t.Time.Location().String() != dbLoc.String() {
|
||||
tm := time.Date(t.Time.Year(), t.Time.Month(), t.Time.Day(), t.Time.Hour(),
|
||||
|
|
@ -117,6 +133,9 @@ func AsTime(src interface{}, dbLoc *time.Location, uiLoc *time.Location) (*time.
|
|||
tm := t.Time.In(uiLoc)
|
||||
return &tm, nil
|
||||
case *time.Time:
|
||||
if utils.IsTimeZero(*t) {
|
||||
return &time.Time{}, nil
|
||||
}
|
||||
z, _ := t.Zone()
|
||||
if len(z) == 0 || t.Year() == 0 || t.Location().String() != dbLoc.String() {
|
||||
tm := time.Date(t.Year(), t.Month(), t.Day(), t.Hour(),
|
||||
|
|
@ -126,6 +145,9 @@ func AsTime(src interface{}, dbLoc *time.Location, uiLoc *time.Location) (*time.
|
|||
tm := t.In(uiLoc)
|
||||
return &tm, nil
|
||||
case time.Time:
|
||||
if utils.IsTimeZero(t) {
|
||||
return &time.Time{}, nil
|
||||
}
|
||||
z, _ := t.Zone()
|
||||
if len(z) == 0 || t.Year() == 0 || t.Location().String() != dbLoc.String() {
|
||||
tm := time.Date(t.Year(), t.Month(), t.Day(), t.Hour(),
|
||||
|
|
@ -135,12 +157,21 @@ func AsTime(src interface{}, dbLoc *time.Location, uiLoc *time.Location) (*time.
|
|||
tm := t.In(uiLoc)
|
||||
return &tm, nil
|
||||
case int:
|
||||
if t == 0 {
|
||||
return &time.Time{}, nil
|
||||
}
|
||||
tm := time.Unix(int64(t), 0).In(uiLoc)
|
||||
return &tm, nil
|
||||
case int64:
|
||||
if t == 0 {
|
||||
return &time.Time{}, nil
|
||||
}
|
||||
tm := time.Unix(t, 0).In(uiLoc)
|
||||
return &tm, nil
|
||||
case *sql.NullInt64:
|
||||
if t.Int64 == 0 {
|
||||
return &time.Time{}, nil
|
||||
}
|
||||
tm := time.Unix(t.Int64, 0).In(uiLoc)
|
||||
return &tm, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -618,8 +618,8 @@ func (db *dameng) SQLType(c *schemas.Column) string {
|
|||
res = t
|
||||
}
|
||||
|
||||
hasLen1 := (c.Length > 0)
|
||||
hasLen2 := (c.Length2 > 0)
|
||||
hasLen1 := c.Length > 0
|
||||
hasLen2 := c.Length2 > 0
|
||||
|
||||
if hasLen2 {
|
||||
res += "(" + strconv.FormatInt(c.Length, 10) + "," + strconv.FormatInt(c.Length2, 10) + ")"
|
||||
|
|
@ -831,6 +831,13 @@ func (d *dmClobScanner) Scan(data interface{}) error {
|
|||
d.data = string(t)
|
||||
d.valid = true
|
||||
return nil
|
||||
case string:
|
||||
if len(t) <= 0 {
|
||||
return nil
|
||||
}
|
||||
d.data = string(t)
|
||||
d.valid = true
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("cannot convert %T as dmClobScanner", data)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -279,6 +279,7 @@ func regDrvsNDialects() bool {
|
|||
"pgx": {"postgres", func() Driver { return &pqDriverPgx{} }, func() Dialect { return &postgres{} }},
|
||||
"sqlite3": {"sqlite3", func() Driver { return &sqlite3Driver{} }, func() Dialect { return &sqlite3{} }},
|
||||
"sqlite": {"sqlite3", func() Driver { return &sqlite3Driver{} }, func() Dialect { return &sqlite3{} }},
|
||||
"libsql": {"sqlite3", func() Driver { return &sqlite3Driver{} }, func() Dialect { return &sqlite3{} }},
|
||||
"oci8": {"oracle", func() Driver { return &oci8Driver{} }, func() Dialect { return &oracle{} }},
|
||||
"godror": {"oracle", func() Driver { return &godrorDriver{} }, func() Dialect { return &oracle{} }},
|
||||
"oracle": {"oracle", func() Driver { return &oracleDriver{} }, func() Dialect { return &oracle{} }},
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -330,15 +330,11 @@ func (db *mssql) SQLType(c *schemas.Column) string {
|
|||
res += "(MAX)"
|
||||
}
|
||||
case schemas.TimeStamp, schemas.DateTime:
|
||||
if c.Length > 3 {
|
||||
res = "DATETIME2"
|
||||
} else {
|
||||
return schemas.DateTime
|
||||
}
|
||||
return "DATETIME2"
|
||||
case schemas.TimeStampz:
|
||||
res = "DATETIMEOFFSET"
|
||||
c.Length = 7
|
||||
case schemas.MediumInt, schemas.TinyInt, schemas.SmallInt, schemas.UnsignedMediumInt, schemas.UnsignedTinyInt, schemas.UnsignedSmallInt:
|
||||
case schemas.MediumInt, schemas.SmallInt, schemas.UnsignedMediumInt, schemas.UnsignedTinyInt, schemas.UnsignedSmallInt:
|
||||
res = schemas.Int
|
||||
case schemas.Text, schemas.MediumText, schemas.TinyText, schemas.LongText, schemas.Json:
|
||||
res = db.defaultVarchar + "(MAX)"
|
||||
|
|
@ -381,8 +377,8 @@ func (db *mssql) SQLType(c *schemas.Column) string {
|
|||
return res
|
||||
}
|
||||
|
||||
hasLen1 := (c.Length > 0)
|
||||
hasLen2 := (c.Length2 > 0)
|
||||
hasLen1 := c.Length > 0
|
||||
hasLen2 := c.Length2 > 0
|
||||
|
||||
if hasLen2 {
|
||||
res += "(" + strconv.FormatInt(c.Length, 10) + "," + strconv.FormatInt(c.Length2, 10) + ")"
|
||||
|
|
@ -586,10 +582,10 @@ func (db *mssql) GetIndexes(queryer core.Queryer, ctx context.Context, tableName
|
|||
IXS.NAME AS [INDEX_NAME],
|
||||
C.NAME AS [COLUMN_NAME],
|
||||
IXS.is_unique AS [IS_UNIQUE]
|
||||
FROM SYS.INDEXES IXS
|
||||
INNER JOIN SYS.INDEX_COLUMNS IXCS
|
||||
FROM sys.indexes IXS
|
||||
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
|
||||
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) =?
|
||||
`
|
||||
|
|
|
|||
|
|
@ -326,8 +326,8 @@ func (db *mysql) SQLType(c *schemas.Column) string {
|
|||
res = t
|
||||
}
|
||||
|
||||
hasLen1 := (c.Length > 0)
|
||||
hasLen2 := (c.Length2 > 0)
|
||||
hasLen1 := c.Length > 0
|
||||
hasLen2 := c.Length2 > 0
|
||||
|
||||
if res == schemas.BigInt && !hasLen1 && !hasLen2 {
|
||||
c.Length = 20
|
||||
|
|
@ -402,6 +402,9 @@ func (db *mysql) AddColumnSQL(tableName string, col *schemas.Column) string {
|
|||
// ModifyColumnSQL returns a SQL to modify SQL
|
||||
func (db *mysql) ModifyColumnSQL(tableName string, col *schemas.Column) string {
|
||||
s, _ := ColumnString(db.dialect, col, false, true)
|
||||
if col.IsAutoIncrement {
|
||||
s += " " + db.AutoIncrStr()
|
||||
}
|
||||
if col.Comment != "" {
|
||||
s += fmt.Sprintf(" COMMENT '%s'", col.Comment)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -585,8 +585,8 @@ func (db *oracle) SQLType(c *schemas.Column) string {
|
|||
res = t
|
||||
}
|
||||
|
||||
hasLen1 := (c.Length > 0)
|
||||
hasLen2 := (c.Length2 > 0)
|
||||
hasLen1 := c.Length > 0
|
||||
hasLen2 := c.Length2 > 0
|
||||
|
||||
if hasLen2 {
|
||||
res += "(" + strconv.FormatInt(c.Length, 10) + "," + strconv.FormatInt(c.Length2, 10) + ")"
|
||||
|
|
@ -684,6 +684,17 @@ func (db *oracle) IndexCheckSQL(tableName, idxName string) (string, []interface{
|
|||
`WHERE TABLE_NAME = :1 AND INDEX_NAME = :2`, args
|
||||
}
|
||||
|
||||
func (db *oracle) DropIndexSQL(tableName string, index *schemas.Index) string {
|
||||
quote := db.dialect.Quoter().Quote
|
||||
var name string
|
||||
if index.IsRegular {
|
||||
name = index.XName(tableName)
|
||||
} else {
|
||||
name = index.Name
|
||||
}
|
||||
return fmt.Sprintf("DROP INDEX %v", quote(name))
|
||||
}
|
||||
|
||||
func (db *oracle) IsTableExist(queryer core.Queryer, ctx context.Context, tableName string) (bool, error) {
|
||||
return db.HasRecords(queryer, ctx, `SELECT table_name FROM user_tables WHERE table_name = :1`, tableName)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -957,8 +957,8 @@ func (db *postgres) SQLType(c *schemas.Column) string {
|
|||
// for bool, we don't need length information
|
||||
return res
|
||||
}
|
||||
hasLen1 := (c.Length > 0)
|
||||
hasLen2 := (c.Length2 > 0)
|
||||
hasLen1 := c.Length > 0
|
||||
hasLen2 := c.Length2 > 0
|
||||
|
||||
if hasLen2 {
|
||||
res += "(" + strconv.FormatInt(c.Length, 10) + "," + strconv.FormatInt(c.Length2, 10) + ")"
|
||||
|
|
@ -1185,7 +1185,7 @@ WHERE n.nspname= s.table_schema AND c.relkind = 'r' AND c.relname = $1%s AND f.a
|
|||
col.IsPrimaryKey = true
|
||||
}
|
||||
|
||||
col.Nullable = (isNullable == "YES")
|
||||
col.Nullable = isNullable == "YES"
|
||||
|
||||
switch strings.ToLower(dataType) {
|
||||
case "character varying", "string":
|
||||
|
|
|
|||
|
|
@ -7,20 +7,23 @@ package dialects
|
|||
import (
|
||||
"strings"
|
||||
"time"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
// FormatColumnTime format column time
|
||||
func FormatColumnTime(dialect Dialect, dbLocation *time.Location, col *schemas.Column, t time.Time) (interface{}, error) {
|
||||
if t.IsZero() {
|
||||
if utils.IsTimeZero(t) {
|
||||
if col.Nullable {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if col.SQLType.IsNumeric() {
|
||||
return 0, nil
|
||||
}
|
||||
if col.SQLType.Name == schemas.TimeStamp || col.SQLType.Name == schemas.TimeStampz {
|
||||
t = time.Unix(0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
tmZone := dbLocation
|
||||
|
|
|
|||
26
engine.go
26
engine.go
|
|
@ -51,7 +51,7 @@ type Engine struct {
|
|||
|
||||
// NewEngine new a db manager according to the parameter. Currently support four
|
||||
// drivers
|
||||
func NewEngine(driverName string, dataSourceName string) (*Engine, error) {
|
||||
func NewEngine(driverName string, dataSourceName string, driverOptions ...func(db *sql.DB) error) (*Engine, error) {
|
||||
dialect, err := dialects.OpenDialect(driverName, dataSourceName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -62,6 +62,12 @@ func NewEngine(driverName string, dataSourceName string) (*Engine, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
for _, driverOption := range driverOptions {
|
||||
if err := driverOption(db.DB); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return newEngine(driverName, dataSourceName, dialect, db)
|
||||
}
|
||||
|
||||
|
|
@ -792,6 +798,22 @@ func (engine *Engine) dumpTables(ctx context.Context, tables []*schemas.Table, w
|
|||
return err
|
||||
}
|
||||
}
|
||||
} else if sess.engine.dialect.URI().DBType == schemas.GBASE8S {
|
||||
stp.Name = strings.Replace(stp.Name, "SQLT_", "", 1)
|
||||
if stp.IsTime() && len(s.String) == 20 { // "2025-06-10T07:55:31Z"
|
||||
t, err := time.Parse(time.RFC3339, s.String)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse time %s: %v", s.String, err)
|
||||
}
|
||||
r := t.Format("2006-01-02 15:04:05")
|
||||
if _, err = io.WriteString(w, "'"+r+"'"); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if _, err = io.WriteString(w, "'"+strings.ReplaceAll(s.String, "'", "''")+"'"); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if _, err = io.WriteString(w, "'"+strings.ReplaceAll(s.String, "'", "''")+"'"); err != nil {
|
||||
return err
|
||||
|
|
@ -1206,7 +1228,7 @@ func (engine *Engine) Insert(beans ...interface{}) (int64, error) {
|
|||
func (engine *Engine) InsertOne(bean interface{}) (int64, error) {
|
||||
session := engine.NewSession()
|
||||
defer session.Close()
|
||||
return session.InsertOne(bean)
|
||||
return session.Insert(bean)
|
||||
}
|
||||
|
||||
// Update records, bean's non-empty fields are updated contents,
|
||||
|
|
|
|||
46
go.mod
46
go.mod
|
|
@ -1,21 +1,57 @@
|
|||
module xorm.io/xorm
|
||||
|
||||
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/jackc/pgx/v4 v4.18.2
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/lib/pq v1.10.7
|
||||
github.com/mattn/go-sqlite3 v1.14.16
|
||||
github.com/microsoft/go-mssqldb v1.6.0
|
||||
github.com/shopspring/decimal v1.3.1
|
||||
github.com/stretchr/testify v1.8.1
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/syndtr/goleveldb v1.0.0
|
||||
github.com/ziutek/mymysql v1.5.4
|
||||
modernc.org/sqlite v1.20.4
|
||||
xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978
|
||||
)
|
||||
|
||||
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-20220223132316-b832511892a9 // 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.3 // indirect
|
||||
github.com/jackc/pgio v1.0.0 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgproto3/v2 v2.3.3 // 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.20.0 // indirect
|
||||
golang.org/x/mod v0.8.0 // indirect
|
||||
golang.org/x/sys v0.17.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
golang.org/x/tools v0.6.0 // 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
|
||||
)
|
||||
|
|
|
|||
123
go.sum
123
go.sum
|
|
@ -2,15 +2,15 @@ gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGq
|
|||
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU=
|
||||
gitee.com/travelliu/dm v1.8.11192 h1:aqJT0xhodZjRutIfEXxKYv0CxqmHUHzsbz6SFaRL6OY=
|
||||
gitee.com/travelliu/dm v1.8.11192/go.mod h1:DHTzyhCrM843x9VdKVbZ+GKXGRbKM2sJ4LxihRxShkE=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1 h1:/iHxaJhsFr0+xVFfbMr5vxz848jyiWuIEDhYq3y5odY=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.0 h1:yfJe15aSwEQ6Oo6J+gdfdulPNoZ3TEhmbhLIoxZcA+U=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v0.8.0 h1:T028gtTPiYt/RMUfs8nVsAL7FDQrfLlrm/NnRG/zcC4=
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.1.0 h1:HCc0+LpPfpCKs6LGGLAhwBARt9632unrVcI6i8s/8os=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
|
||||
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
||||
github.com/chzyer/logex v1.2.0/go.mod h1:9+9sk7u7pGNWYMkh0hdiL++6OeibzJccyQU4p4MedaY=
|
||||
github.com/chzyer/readline v1.5.0/go.mod h1:x22KAscuvRqlLoK9CsoYsmxoXZMMFVyOl86cAH8qUic=
|
||||
github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
|
||||
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
|
|
@ -19,9 +19,6 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do
|
|||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/denisenkom/go-mssqldb v0.12.3 h1:pBSGx9Tq67pBOTLmxNuirNTeB8Vjmf886Kx+8Y+8shw=
|
||||
github.com/denisenkom/go-mssqldb v0.12.3/go.mod h1:k0mtMFOnU+AihqFxPMiF05rtiDrorD1Vrm1KEz5hxDo=
|
||||
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
|
||||
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
|
||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
|
|
@ -34,8 +31,9 @@ github.com/goccy/go-json v0.8.1 h1:4/Wjm0JIJaTDm8K1KcGrLHJoa8EsJ13YWeX+6Kfq6uI=
|
|||
github.com/goccy/go-json v0.8.1/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
|
||||
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
|
||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||
github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE=
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||
github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
|
||||
github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
|
|
@ -43,19 +41,14 @@ github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8l
|
|||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ=
|
||||
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
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=
|
||||
|
|
@ -66,8 +59,8 @@ github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsU
|
|||
github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o=
|
||||
github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY=
|
||||
github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI=
|
||||
github.com/jackc/pgconn v1.14.0 h1:vrbA9Ud87g6JdFWkHTJXppVce58qPIdP7N8y0Ml/A7Q=
|
||||
github.com/jackc/pgconn v1.14.0/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E=
|
||||
github.com/jackc/pgconn v1.14.3 h1:bVoTr12EGANZz66nZPkMInAV/KHD2TxH9npjXXgiB3w=
|
||||
github.com/jackc/pgconn v1.14.3/go.mod h1:RZbme4uasqzybK2RK5c65VsHxoyaml09lx3tXOcO/VM=
|
||||
github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE=
|
||||
github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
|
||||
github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE=
|
||||
|
|
@ -76,7 +69,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=
|
||||
|
|
@ -84,8 +76,8 @@ github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvW
|
|||
github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
|
||||
github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
|
||||
github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
|
||||
github.com/jackc/pgproto3/v2 v2.3.2 h1:7eY55bdBeCz1F2fTzSz69QC+pG46jYq9/jtSPiJ5nn0=
|
||||
github.com/jackc/pgproto3/v2 v2.3.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
|
||||
github.com/jackc/pgproto3/v2 v2.3.3 h1:1HLSx5H+tXR9pW3in3zaztoEwQYRC9SQaYUHjTSUOag=
|
||||
github.com/jackc/pgproto3/v2 v2.3.3/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
|
||||
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
|
||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
|
||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
||||
|
|
@ -99,12 +91,11 @@ github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08
|
|||
github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM=
|
||||
github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc=
|
||||
github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs=
|
||||
github.com/jackc/pgx/v4 v4.18.0 h1:Ltaa1ePvc7msFGALnCrqKJVEByu/qYh5jJBYcDtAno4=
|
||||
github.com/jackc/pgx/v4 v4.18.0/go.mod h1:FydWkUyadDmdNH/mHnGob881GawxeEm7TcMCzkb+qQE=
|
||||
github.com/jackc/pgx/v4 v4.18.2 h1:xVpYkNR5pk5bMCZGfClbO962UIqVABcAGt7ha1s/FeU=
|
||||
github.com/jackc/pgx/v4 v4.18.2/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw=
|
||||
github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||
github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||
github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||
github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
||||
|
|
@ -118,6 +109,7 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
|||
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
|
|
@ -131,20 +123,20 @@ github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd
|
|||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/microsoft/go-mssqldb v1.6.0 h1:mM3gYdVwEPFrlg/Dvr2DNVEgYFG7L42l+dGc67NNNpc=
|
||||
github.com/microsoft/go-mssqldb v1.6.0/go.mod h1:00mDtPbeQCRGC1HwOOR5K/gr30P1NcEG0vx6Kbv2aJU=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
|
||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
|
||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
|
|
@ -165,21 +157,15 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
|
|||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
|
||||
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
|
||||
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 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=
|
||||
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
|
||||
|
|
@ -200,36 +186,26 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
|
|||
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
|
||||
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
|
||||
golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg=
|
||||
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
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-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
|
@ -241,28 +217,20 @@ golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
|
|
@ -270,16 +238,13 @@ golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgw
|
|||
golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||
|
|
@ -291,44 +256,26 @@ gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:a
|
|||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
|
||||
lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI=
|
||||
lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
|
||||
modernc.org/cc/v3 v3.37.0/go.mod h1:vtL+3mdHx/wcj3iEGz84rQa8vEqR6XM84v5Lcvfph20=
|
||||
modernc.org/cc/v3 v3.38.1/go.mod h1:vtL+3mdHx/wcj3iEGz84rQa8vEqR6XM84v5Lcvfph20=
|
||||
modernc.org/cc/v3 v3.40.0 h1:P3g79IUS/93SYhtoeaHW+kRCIrYaxJ27MFPv+7kaTOw=
|
||||
modernc.org/cc/v3 v3.40.0/go.mod h1:/bTg4dnWkSXowUO6ssQKnOV0yMVxDYNIsIrzqTFDGH0=
|
||||
modernc.org/ccgo/v3 v3.0.0-20220904174949-82d86e1b6d56/go.mod h1:YSXjPL62P2AMSxBphRHPn7IkzhVHqkvOnRKAKh+W6ZI=
|
||||
modernc.org/ccgo/v3 v3.0.0-20220910160915-348f15de615a/go.mod h1:8p47QxPkdugex9J4n9P2tLZ9bK01yngIVp00g4nomW0=
|
||||
modernc.org/ccgo/v3 v3.16.13-0.20221017192402-261537637ce8/go.mod h1:fUB3Vn0nVPReA+7IG7yZDfjv1TMWjhQP8gCxrFAtL5g=
|
||||
modernc.org/ccgo/v3 v3.16.13 h1:Mkgdzl46i5F/CNR/Kj80Ri59hC8TKAhZrYSaqvkwzUw=
|
||||
modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY=
|
||||
modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk=
|
||||
modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ=
|
||||
modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM=
|
||||
modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM=
|
||||
modernc.org/libc v1.17.4/go.mod h1:WNg2ZH56rDEwdropAJeZPQkXmDwh+JCA1s/htl6r2fA=
|
||||
modernc.org/libc v1.18.0/go.mod h1:vj6zehR5bfc98ipowQOM2nIDUZnVew/wNC/2tOGS+q0=
|
||||
modernc.org/libc v1.19.0/go.mod h1:ZRfIaEkgrYgZDl6pa4W39HgN5G/yDW+NRmNKZBDFrk0=
|
||||
modernc.org/libc v1.20.3/go.mod h1:ZRfIaEkgrYgZDl6pa4W39HgN5G/yDW+NRmNKZBDFrk0=
|
||||
modernc.org/libc v1.21.4/go.mod h1:przBsL5RDOZajTVslkugzLBj1evTue36jEomFQOoYuI=
|
||||
modernc.org/libc v1.22.2 h1:4U7v51GyhlWqQmwCHj28Rdq2Yzwk55ovjFrdPjs8Hb0=
|
||||
modernc.org/libc v1.22.2/go.mod h1:uvQavJ1pZ0hIoC/jfqNoMLURIMhKzINIWypNM17puug=
|
||||
modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ=
|
||||
modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/memory v1.3.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU=
|
||||
modernc.org/memory v1.4.0 h1:crykUfNSnMAXaOJnnxcSzbUGMqkLWjklJKkBK2nwZwk=
|
||||
modernc.org/memory v1.4.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU=
|
||||
modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
||||
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
|
||||
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
||||
modernc.org/sqlite v1.20.4 h1:J8+m2trkN+KKoE7jglyHYYYiaq5xmz2HoHJIiBlRzbE=
|
||||
|
|
@ -336,10 +283,8 @@ modernc.org/sqlite v1.20.4/go.mod h1:zKcGyrICaxNTMEHSr1HQ2GUraP0j+845GYw37+EyT6A
|
|||
modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY=
|
||||
modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw=
|
||||
modernc.org/tcl v1.15.0 h1:oY+JeD11qVVSgVvodMJsu7Edf8tr5E/7tuhF5cNYz34=
|
||||
modernc.org/tcl v1.15.0/go.mod h1:xRoGotBZ6dU+Zo2tca+2EqVEeMmOUBzHnhIwq4YrVnE=
|
||||
modernc.org/token v1.0.1 h1:A3qvTqOwexpfZZeyI0FeGPDlSWX5pjZu9hF4lU+EKWg=
|
||||
modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
||||
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=
|
||||
|
|
|
|||
|
|
@ -5,10 +5,23 @@
|
|||
package statements
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
type DateTimeString struct {
|
||||
Layout string
|
||||
Str string
|
||||
}
|
||||
|
||||
// Value implements the driver Valuer interface.
|
||||
func (n DateTimeString) Value() (driver.Value, error) {
|
||||
return n.Str, nil
|
||||
}
|
||||
|
||||
// WriteArg writes an arg
|
||||
func (statement *Statement) WriteArg(w *builder.BytesWriter, arg interface{}) error {
|
||||
switch argv := arg.(type) {
|
||||
|
|
@ -22,6 +35,17 @@ func (statement *Statement) WriteArg(w *builder.BytesWriter, arg interface{}) er
|
|||
if _, err := w.WriteString(")"); err != nil {
|
||||
return err
|
||||
}
|
||||
case *DateTimeString:
|
||||
if statement.dialect.URI().DBType == schemas.ORACLE {
|
||||
if _, err := fmt.Fprintf(w, `TO_DATE(?,'%s')`, argv.Layout); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := w.WriteByte('?'); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
w.Append(arg)
|
||||
default:
|
||||
if err := w.WriteByte('?'); err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -19,8 +19,9 @@ func (statement *Statement) isUsingLegacyLimitOffset() bool {
|
|||
func (statement *Statement) writeMssqlLegacySelect(buf *builder.BytesWriter, columnStr string) error {
|
||||
return statement.writeMultiple(buf,
|
||||
statement.writeStrings("SELECT"),
|
||||
statement.writeDistinct,
|
||||
statement.writeTop,
|
||||
statement.writeDistinct,
|
||||
statement.writeStrings(" ", columnStr),
|
||||
statement.writeFrom,
|
||||
statement.writeWhereWithMssqlPagination,
|
||||
statement.writeGroupBy,
|
||||
|
|
@ -34,6 +35,7 @@ func (statement *Statement) writeOracleLegacySelect(buf *builder.BytesWriter, co
|
|||
return statement.writeMultiple(buf,
|
||||
statement.writeSelectColumns(columnStr),
|
||||
statement.writeFrom,
|
||||
statement.writeWhere,
|
||||
statement.writeOracleLimit(columnStr),
|
||||
statement.writeGroupBy,
|
||||
statement.writeHaving,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ var ErrNoColumnName = errors.New("no column name")
|
|||
|
||||
func (statement *Statement) writeOrderBy(w *builder.BytesWriter, orderBy orderBy) error {
|
||||
switch t := orderBy.orderStr.(type) {
|
||||
case (*builder.Expression):
|
||||
case *builder.Expression:
|
||||
if _, err := fmt.Fprint(w.Builder, statement.dialect.Quoter().Replace(t.Content())); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ func (statement *Statement) Reset() {
|
|||
// SQL adds raw sql statement
|
||||
func (statement *Statement) SQL(query interface{}, args ...interface{}) *Statement {
|
||||
switch t := query.(type) {
|
||||
case (*builder.Builder):
|
||||
case *builder.Builder:
|
||||
var err error
|
||||
statement.RawSQL, statement.RawParams, err = t.ToSQL()
|
||||
if err != nil {
|
||||
|
|
@ -616,7 +616,7 @@ func (statement *Statement) BuildConds(table *schemas.Table, bean interface{}, i
|
|||
// MergeConds merge conditions from bean and id
|
||||
func (statement *Statement) MergeConds(bean interface{}) error {
|
||||
if !statement.NoAutoCondition && statement.RefTable != nil {
|
||||
addedTableName := (len(statement.joins) > 0)
|
||||
addedTableName := len(statement.joins) > 0
|
||||
autoCond, err := statement.BuildConds(statement.RefTable, bean, true, true, false, true, addedTableName)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -713,11 +713,14 @@ func (statement *Statement) CondDeleted(col *schemas.Column) builder.Cond {
|
|||
cond := builder.NewCond()
|
||||
if col.SQLType.IsNumeric() {
|
||||
cond = builder.Eq{colName: 0}
|
||||
} else {
|
||||
// FIXME: mssql: The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.
|
||||
if statement.dialect.URI().DBType != schemas.MSSQL {
|
||||
cond = builder.Eq{colName: utils.ZeroTime1}
|
||||
} else if col.SQLType.Name == schemas.TimeStamp || col.SQLType.Name == schemas.TimeStampz {
|
||||
tmZone := statement.defaultTimeZone
|
||||
if col.TimeZone != nil {
|
||||
tmZone = col.TimeZone
|
||||
}
|
||||
cond = builder.Eq{colName: time.Unix(0, 0).In(tmZone).Format("2006-01-02 15:04:05.999999999")}
|
||||
} else {
|
||||
cond = builder.Eq{colName: utils.ZeroTime1}
|
||||
}
|
||||
|
||||
if col.Nullable {
|
||||
|
|
|
|||
|
|
@ -126,6 +126,9 @@ func (statement *Statement) BuildUpdates(tableValue reflect.Value,
|
|||
|
||||
if fieldValue.CanAddr() {
|
||||
if structConvert, ok := fieldValue.Addr().Interface().(convert.Conversion); ok {
|
||||
if !includeNil && !requiredField && utils.IsZero(fieldValue.Interface()) {
|
||||
continue
|
||||
}
|
||||
data, err := structConvert.ToDB()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
|
|
|||
|
|
@ -88,7 +88,20 @@ func (statement *Statement) Value2Interface(col *schemas.Column, fieldValue refl
|
|||
if fieldType.ConvertibleTo(schemas.TimeType) {
|
||||
t := fieldValue.Convert(schemas.TimeType).Interface().(time.Time)
|
||||
tf, err := dialects.FormatColumnTime(statement.dialect, statement.defaultTimeZone, col, t)
|
||||
return tf, err
|
||||
if val, ok := tf.(string); ok {
|
||||
var layout string
|
||||
switch col.SQLType.Name {
|
||||
case schemas.Date:
|
||||
layout = "yyyy-MM-dd"
|
||||
case schemas.Time:
|
||||
layout = "HH24:mi:ss"
|
||||
default:
|
||||
layout = "yyyy-MM-dd HH24:mi:ss"
|
||||
}
|
||||
return &DateTimeString{Layout: layout, Str: val}, err
|
||||
} else {
|
||||
return tf, err
|
||||
}
|
||||
} else if fieldType.ConvertibleTo(nullFloatType) {
|
||||
t := fieldValue.Convert(nullFloatType).Interface().(sql.NullFloat64)
|
||||
if !t.Valid {
|
||||
|
|
|
|||
|
|
@ -146,6 +146,6 @@ const (
|
|||
|
||||
// IsTimeZero return true if a time is zero
|
||||
func IsTimeZero(t time.Time) bool {
|
||||
return t.IsZero() || t.Format("2006-01-02 15:04:05") == ZeroTime0 ||
|
||||
t.Format("2006-01-02 15:04:05") == ZeroTime1
|
||||
return t.IsZero() || t.Format("2006-01-02 15:04:05.999999999") == ZeroTime0 ||
|
||||
t.Format("2006-01-02 15:04:05.999999999") == ZeroTime1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
package migrate
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
// MigrateFunc is the func signature for migrating.
|
||||
|
|
@ -87,7 +90,11 @@ func (m *Migrate) Migrate() error {
|
|||
return err
|
||||
}
|
||||
|
||||
if m.initSchema != nil && m.isFirstRun() {
|
||||
isFirstRun, err := m.isFirstRun()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if m.initSchema != nil && isFirstRun {
|
||||
return m.runInitSchema()
|
||||
}
|
||||
|
||||
|
|
@ -136,7 +143,9 @@ func (m *Migrate) RollbackMigration(mig *Migration) error {
|
|||
return err
|
||||
}
|
||||
|
||||
sql := fmt.Sprintf("DELETE FROM %s WHERE %s = ?", m.options.TableName, m.options.IDColumnName)
|
||||
tableName := m.db.TableName(m.options.TableName, true)
|
||||
|
||||
sql := fmt.Sprintf("DELETE FROM %s WHERE %s = ?", tableName, m.options.IDColumnName)
|
||||
if _, err := m.db.Exec(sql, mig.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -188,7 +197,19 @@ func (m *Migrate) createMigrationTableIfNotExists() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
sql := fmt.Sprintf("CREATE TABLE %s (%s VARCHAR(255) PRIMARY KEY)", m.options.TableName, m.options.IDColumnName)
|
||||
idCol := schemas.NewColumn(m.options.IDColumnName, "", schemas.SQLType{
|
||||
Name: "VARCHAR",
|
||||
}, 255, 0, false)
|
||||
idCol.IsPrimaryKey = true
|
||||
|
||||
table := schemas.NewTable(m.options.TableName, reflect.TypeOf(new(schemas.Table)))
|
||||
table.AddColumn(idCol)
|
||||
|
||||
sql, _, err := m.db.Dialect().CreateTableSQL(context.Background(), m.db.DB(), table, m.options.TableName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := m.db.Exec(sql); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -196,19 +217,21 @@ func (m *Migrate) createMigrationTableIfNotExists() error {
|
|||
}
|
||||
|
||||
func (m *Migrate) migrationDidRun(mig *Migration) (bool, error) {
|
||||
count, err := m.db.SQL(fmt.Sprintf("SELECT COUNT(*) FROM %s WHERE %s = ?", m.options.TableName, m.options.IDColumnName), mig.ID).Count()
|
||||
tableName := m.db.TableName(m.options.TableName, true)
|
||||
count, err := m.db.SQL(fmt.Sprintf("SELECT COUNT(*) FROM %s WHERE %s = ?", tableName, m.options.IDColumnName), mig.ID).Count()
|
||||
return count > 0, err
|
||||
}
|
||||
|
||||
func (m *Migrate) isFirstRun() bool {
|
||||
row := m.db.DB().QueryRow(fmt.Sprintf("SELECT COUNT(*) FROM %s", m.options.TableName))
|
||||
func (m *Migrate) isFirstRun() (bool, error) {
|
||||
var count int
|
||||
_ = row.Scan(&count)
|
||||
return count == 0
|
||||
tableName := m.db.TableName(m.options.TableName, true)
|
||||
_, err := m.db.SQL(fmt.Sprintf("SELECT COUNT(*) FROM %s", tableName)).Get(&count)
|
||||
return count == 0, err
|
||||
}
|
||||
|
||||
func (m *Migrate) insertMigration(id string) error {
|
||||
sql := fmt.Sprintf("INSERT INTO %s (%s) VALUES (?)", m.options.TableName, m.options.IDColumnName)
|
||||
tableName := m.db.TableName(m.options.TableName, true)
|
||||
sql := fmt.Sprintf("INSERT INTO %s (%s) VALUES (?)", tableName, m.options.IDColumnName)
|
||||
_, err := m.db.Exec(sql, id)
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,28 +26,26 @@ const (
|
|||
dbName = "testdb.sqlite3"
|
||||
)
|
||||
|
||||
var (
|
||||
migrations = []*Migration{
|
||||
{
|
||||
ID: "201608301400",
|
||||
Migrate: func(tx *xorm.Engine) error {
|
||||
return tx.Sync(&Person{})
|
||||
},
|
||||
Rollback: func(tx *xorm.Engine) error {
|
||||
return tx.DropTables(&Person{})
|
||||
},
|
||||
var migrations = []*Migration{
|
||||
{
|
||||
ID: "201608301400",
|
||||
Migrate: func(tx *xorm.Engine) error {
|
||||
return tx.Sync(&Person{})
|
||||
},
|
||||
{
|
||||
ID: "201608301430",
|
||||
Migrate: func(tx *xorm.Engine) error {
|
||||
return tx.Sync(&Pet{})
|
||||
},
|
||||
Rollback: func(tx *xorm.Engine) error {
|
||||
return tx.DropTables(&Pet{})
|
||||
},
|
||||
Rollback: func(tx *xorm.Engine) error {
|
||||
return tx.DropTables(&Person{})
|
||||
},
|
||||
}
|
||||
)
|
||||
},
|
||||
{
|
||||
ID: "201608301430",
|
||||
Migrate: func(tx *xorm.Engine) error {
|
||||
return tx.Sync(&Pet{})
|
||||
},
|
||||
Rollback: func(tx *xorm.Engine) error {
|
||||
return tx.DropTables(&Pet{})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func TestMigration(t *testing.T) {
|
||||
_ = os.Remove(dbName)
|
||||
|
|
@ -58,7 +56,7 @@ func TestMigration(t *testing.T) {
|
|||
}
|
||||
defer db.Close()
|
||||
|
||||
if err = db.DB().Ping(); err != nil {
|
||||
if err = db.Ping(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +95,7 @@ func TestInitSchema(t *testing.T) {
|
|||
log.Fatal(err)
|
||||
}
|
||||
defer db.Close()
|
||||
if err = db.DB().Ping(); err != nil {
|
||||
if err = db.Ping(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +124,7 @@ func TestMissingID(t *testing.T) {
|
|||
if db != nil {
|
||||
defer db.Close()
|
||||
}
|
||||
assert.NoError(t, db.DB().Ping())
|
||||
assert.NoError(t, db.Ping())
|
||||
|
||||
migrationsMissingID := []*Migration{
|
||||
{
|
||||
|
|
@ -141,7 +139,6 @@ func TestMissingID(t *testing.T) {
|
|||
}
|
||||
|
||||
func tableCount(db *xorm.Engine, tableName string) (count int) {
|
||||
row := db.DB().QueryRow(fmt.Sprintf("SELECT COUNT(*) FROM %s", tableName))
|
||||
_ = row.Scan(&count)
|
||||
_, _ = db.SQL(fmt.Sprintf("SELECT COUNT(*) FROM %s", tableName)).Get(&count)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ func isASCIIUpper(r rune) bool {
|
|||
|
||||
func toASCIIUpper(r rune) rune {
|
||||
if 'a' <= r && r <= 'z' {
|
||||
r -= ('a' - 'A')
|
||||
r -= 'a' - 'A'
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ type Column struct {
|
|||
FieldIndex []int // Available only when parsed from a struct
|
||||
SQLType SQLType
|
||||
IsJSON bool
|
||||
IsJSONB bool
|
||||
Length int64
|
||||
Length2 int64
|
||||
Nullable bool
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ const (
|
|||
MSSQL DBType = "mssql"
|
||||
ORACLE DBType = "oracle"
|
||||
DAMENG DBType = "dameng"
|
||||
GBASE8S DBType = "gbase8s"
|
||||
)
|
||||
|
||||
// SQLType represents SQL types
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ func (session *Session) getSlice(rows *core.Rows, types []*sql.ColumnType, field
|
|||
}
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("unspoorted slice type: %t", t)
|
||||
return fmt.Errorf("unsupported slice type: %t", t)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ func (session *Session) getMap(rows *core.Rows, types []*sql.ColumnType, fields
|
|||
}
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("unspoorted map type: %t", t)
|
||||
return fmt.Errorf("unsupported map type: %t", t)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -471,7 +471,8 @@ func (session *Session) genInsertColumns(bean interface{}) ([]string, []interfac
|
|||
}
|
||||
|
||||
if col.IsDeleted {
|
||||
arg, err := dialects.FormatColumnTime(session.engine.dialect, session.engine.DatabaseTZ, col, time.Time{})
|
||||
zeroTime := time.Date(1, 1, 1, 0, 0, 0, 0, session.engine.DatabaseTZ)
|
||||
arg, err := dialects.FormatColumnTime(session.engine.dialect, session.engine.DatabaseTZ, col, zeroTime)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,12 @@ func (session *Session) Iterate(bean interface{}, fun IterFunc) error {
|
|||
defer session.Close()
|
||||
}
|
||||
|
||||
session.autoResetStatement = false
|
||||
defer func() {
|
||||
session.autoResetStatement = true
|
||||
session.resetStatement()
|
||||
}()
|
||||
|
||||
if session.statement.LastError != nil {
|
||||
return session.statement.LastError
|
||||
}
|
||||
|
|
@ -64,15 +70,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
|
||||
|
|
|
|||
12
sync.go
12
sync.go
|
|
@ -17,6 +17,8 @@ type SyncOptions struct {
|
|||
IgnoreConstrains bool
|
||||
// IgnoreIndices will not add or delete indices
|
||||
IgnoreIndices bool
|
||||
// IgnoreDropIndices will not delete indices
|
||||
IgnoreDropIndices bool
|
||||
}
|
||||
|
||||
type SyncResult struct{}
|
||||
|
|
@ -55,6 +57,7 @@ func (session *Session) Sync(beans ...interface{}) error {
|
|||
WarnIfDatabaseColumnMissed: false,
|
||||
IgnoreConstrains: false,
|
||||
IgnoreIndices: false,
|
||||
IgnoreDropIndices: false,
|
||||
}, beans...)
|
||||
return err
|
||||
}
|
||||
|
|
@ -168,7 +171,8 @@ func (session *Session) SyncWithOptions(opts SyncOptions, beans ...interface{})
|
|||
tbNameWithSchema, col.Name, curType, expectedType)
|
||||
}
|
||||
} else if strings.HasPrefix(curType, schemas.Varchar) && strings.HasPrefix(expectedType, schemas.Varchar) {
|
||||
if engine.dialect.URI().DBType == schemas.MYSQL {
|
||||
if engine.dialect.URI().DBType == schemas.POSTGRES ||
|
||||
engine.dialect.URI().DBType == schemas.MYSQL {
|
||||
if oriCol.Length < col.Length {
|
||||
engine.logger.Infof("Table %s column %s change type from varchar(%d) to varchar(%d)\n",
|
||||
tbNameWithSchema, col.Name, oriCol.Length, col.Length)
|
||||
|
|
@ -184,7 +188,8 @@ func (session *Session) SyncWithOptions(opts SyncOptions, beans ...interface{})
|
|||
}
|
||||
}
|
||||
} else if expectedType == schemas.Varchar {
|
||||
if engine.dialect.URI().DBType == schemas.MYSQL {
|
||||
if engine.dialect.URI().DBType == schemas.POSTGRES ||
|
||||
engine.dialect.URI().DBType == schemas.MYSQL {
|
||||
if oriCol.Length < col.Length {
|
||||
engine.logger.Infof("Table %s column %s change type from varchar(%d) to varchar(%d)\n",
|
||||
tbNameWithSchema, col.Name, oriCol.Length, col.Length)
|
||||
|
|
@ -193,6 +198,7 @@ func (session *Session) SyncWithOptions(opts SyncOptions, beans ...interface{})
|
|||
}
|
||||
} else if col.Comment != oriCol.Comment {
|
||||
if engine.dialect.URI().DBType == schemas.POSTGRES ||
|
||||
engine.dialect.URI().DBType == schemas.GBASE8S ||
|
||||
engine.dialect.URI().DBType == schemas.MYSQL {
|
||||
_, err = session.exec(engine.dialect.ModifyColumnSQL(tbNameWithSchema, col))
|
||||
}
|
||||
|
|
@ -244,7 +250,7 @@ func (session *Session) SyncWithOptions(opts SyncOptions, beans ...interface{})
|
|||
for name2, index2 := range oriTable.Indexes {
|
||||
if _, ok := foundIndexNames[name2]; !ok {
|
||||
// ignore based on there type
|
||||
if (index2.Type == schemas.IndexType && opts.IgnoreIndices) ||
|
||||
if (index2.Type == schemas.IndexType && (opts.IgnoreIndices || opts.IgnoreDropIndices)) ||
|
||||
(index2.Type == schemas.UniqueType && opts.IgnoreConstrains) {
|
||||
// make sure we do not add a index with same name later
|
||||
delete(addedNames, name2)
|
||||
|
|
|
|||
|
|
@ -250,10 +250,16 @@ func (parser *Parser) parseFieldWithTags(table *schemas.Table, fieldIndex int, f
|
|||
}
|
||||
|
||||
if col.SQLType.Name == "" {
|
||||
var err error
|
||||
col.SQLType, err = parser.getSQLTypeByType(field.Type)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if col.IsJSONB { // check is jsonb first because it is also json
|
||||
col.SQLType = schemas.SQLType{Name: schemas.Jsonb}
|
||||
} else if col.IsJSON {
|
||||
col.SQLType = schemas.SQLType{Name: schemas.Json}
|
||||
} else {
|
||||
var err error
|
||||
col.SQLType, err = parser.getSQLTypeByType(field.Type)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
if ctx.isUnsigned && col.SQLType.IsNumeric() && !strings.HasPrefix(col.SQLType.Name, "UNSIGNED") {
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ func TestParseWithJSONB(t *testing.T) {
|
|||
assert.EqualValues(t, "struct_with_jsonb", table.Name)
|
||||
assert.EqualValues(t, 1, len(table.Columns()))
|
||||
assert.EqualValues(t, "default1", table.Columns()[0].Name)
|
||||
assert.True(t, table.Columns()[0].IsJSON)
|
||||
assert.True(t, table.Columns()[0].IsJSONB)
|
||||
}
|
||||
|
||||
func TestParseWithSQLType(t *testing.T) {
|
||||
|
|
@ -617,3 +617,53 @@ func TestParseWithSQLType(t *testing.T) {
|
|||
assert.EqualValues(t, "DATETIME", table.Columns()[3].SQLType.Name)
|
||||
assert.EqualValues(t, "UUID", table.Columns()[4].SQLType.Name)
|
||||
}
|
||||
|
||||
func TestParseWithJSONLongText(t *testing.T) {
|
||||
parser := NewParser(
|
||||
"db",
|
||||
dialects.QueryDialect("mysql"),
|
||||
names.GonicMapper{
|
||||
"JSON": true,
|
||||
},
|
||||
names.GonicMapper{
|
||||
"JSON": true,
|
||||
},
|
||||
caches.NewManager(),
|
||||
)
|
||||
|
||||
type StructWithJSONLongText struct {
|
||||
Col1 string `db:"LongText json"`
|
||||
}
|
||||
|
||||
table, err := parser.Parse(reflect.ValueOf(new(StructWithJSONLongText)))
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, "struct_with_json_long_text", table.Name)
|
||||
assert.EqualValues(t, 1, len(table.Columns()))
|
||||
assert.EqualValues(t, "col1", table.Columns()[0].Name)
|
||||
assert.EqualValues(t, "LONGTEXT", table.Columns()[0].SQLType.Name)
|
||||
assert.EqualValues(t, true, table.Columns()[0].IsJSON)
|
||||
|
||||
type StructWithJSONLongText2 struct {
|
||||
Col1 string `db:"json"`
|
||||
}
|
||||
|
||||
table, err = parser.Parse(reflect.ValueOf(new(StructWithJSONLongText2)))
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, "struct_with_json_long_text2", table.Name)
|
||||
assert.EqualValues(t, 1, len(table.Columns()))
|
||||
assert.EqualValues(t, "col1", table.Columns()[0].Name)
|
||||
assert.EqualValues(t, "JSON", table.Columns()[0].SQLType.Name)
|
||||
assert.EqualValues(t, true, table.Columns()[0].IsJSON)
|
||||
|
||||
type StructWithJSONLongText3 struct {
|
||||
Col1 string `db:"jsonb"`
|
||||
}
|
||||
|
||||
table, err = parser.Parse(reflect.ValueOf(new(StructWithJSONLongText3)))
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, "struct_with_json_long_text3", table.Name)
|
||||
assert.EqualValues(t, 1, len(table.Columns()))
|
||||
assert.EqualValues(t, "col1", table.Columns()[0].Name)
|
||||
assert.EqualValues(t, "JSONB", table.Columns()[0].SQLType.Name)
|
||||
assert.EqualValues(t, true, table.Columns()[0].IsJSONB)
|
||||
}
|
||||
|
|
|
|||
22
tags/tag.go
22
tags/tag.go
|
|
@ -124,10 +124,16 @@ var defaultTagHandlers = map[string]Handler{
|
|||
"EXTENDS": ExtendsTagHandler,
|
||||
"UNSIGNED": UnsignedTagHandler,
|
||||
"COLLATE": CollateTagHandler,
|
||||
"JSON": JSONTagHandler,
|
||||
"JSONB": JSONBTagHandler,
|
||||
}
|
||||
|
||||
func init() {
|
||||
for k := range schemas.SqlTypes {
|
||||
// don't override default tag handlers
|
||||
if _, ok := defaultTagHandlers[k]; ok {
|
||||
continue
|
||||
}
|
||||
defaultTagHandlers[k] = SQLTypeTagHandler
|
||||
}
|
||||
}
|
||||
|
|
@ -163,7 +169,7 @@ func PKTagHandler(ctx *Context) error {
|
|||
|
||||
// NULLTagHandler describes null tag handler
|
||||
func NULLTagHandler(ctx *Context) error {
|
||||
ctx.col.Nullable = (strings.ToUpper(ctx.preTag) != "NOT")
|
||||
ctx.col.Nullable = strings.ToUpper(ctx.preTag) != "NOT"
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -293,12 +299,20 @@ func CollateTagHandler(ctx *Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func JSONTagHandler(ctx *Context) error {
|
||||
ctx.col.IsJSON = true
|
||||
return nil
|
||||
}
|
||||
|
||||
func JSONBTagHandler(ctx *Context) error {
|
||||
ctx.col.IsJSONB = true
|
||||
ctx.col.IsJSON = true // jsonb is also json
|
||||
return nil
|
||||
}
|
||||
|
||||
// SQLTypeTagHandler describes SQL Type tag handler
|
||||
func SQLTypeTagHandler(ctx *Context) error {
|
||||
ctx.col.SQLType = schemas.SQLType{Name: ctx.tagUname}
|
||||
if ctx.tagUname == "JSON" || ctx.tagUname == "JSONB" {
|
||||
ctx.col.IsJSON = true
|
||||
}
|
||||
if len(ctx.params) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ import (
|
|||
"xorm.io/xorm/schemas"
|
||||
|
||||
_ "gitee.com/travelliu/dm"
|
||||
_ "github.com/denisenkom/go-mssqldb"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
_ "github.com/jackc/pgx/v4/stdlib"
|
||||
_ "github.com/lib/pq"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
_ "github.com/microsoft/go-mssqldb"
|
||||
"github.com/stretchr/testify/assert"
|
||||
_ "github.com/ziutek/mymysql/godrv"
|
||||
_ "modernc.org/sqlite"
|
||||
|
|
|
|||
|
|
@ -698,7 +698,7 @@ func TestSyncWithOptions(t *testing.T) {
|
|||
assert.NotNil(t, result)
|
||||
assert.Len(t, getIndicesOfBeanFromDB(t, &SyncWithOpts1{}), 0)
|
||||
|
||||
// only ignore indices
|
||||
// only ignore constrains
|
||||
result, err = testEngine.SyncWithOptions(xorm.SyncOptions{IgnoreConstrains: true}, &SyncWithOpts2{})
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, result)
|
||||
|
|
@ -706,7 +706,7 @@ func TestSyncWithOptions(t *testing.T) {
|
|||
assert.Len(t, indices, 2)
|
||||
assert.ElementsMatch(t, []string{"ttt", "index"}, getKeysFromMap(indices))
|
||||
|
||||
// only ignore constrains
|
||||
// only ignore indices
|
||||
result, err = testEngine.SyncWithOptions(xorm.SyncOptions{IgnoreIndices: true}, &SyncWithOpts3{})
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, result)
|
||||
|
|
@ -714,9 +714,16 @@ func TestSyncWithOptions(t *testing.T) {
|
|||
assert.Len(t, indices, 4)
|
||||
assert.ElementsMatch(t, []string{"ttt", "index", "unique", "lll"}, getKeysFromMap(indices))
|
||||
|
||||
// only ignore drop indices
|
||||
result, err = testEngine.SyncWithOptions(xorm.SyncOptions{IgnoreDropIndices: true}, &SyncWithOpts3{})
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, result)
|
||||
indices = getIndicesOfBeanFromDB(t, &SyncWithOpts1{})
|
||||
assert.Len(t, indices, 4)
|
||||
assert.ElementsMatch(t, []string{"ttt", "index", "unique", "lll"}, getKeysFromMap(indices))
|
||||
|
||||
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 {
|
||||
|
|
@ -744,3 +751,72 @@ func getKeysFromMap(m map[string]*schemas.Index) []string {
|
|||
}
|
||||
return ss
|
||||
}
|
||||
|
||||
type SyncTestUser struct {
|
||||
Id int64 `xorm:"pk autoincr 'id' comment('primary key 1')"`
|
||||
Name string `xorm:"'name' notnull comment('nickname')" json:"name"`
|
||||
}
|
||||
|
||||
func (m *SyncTestUser) TableName() string {
|
||||
return "sync_test_user"
|
||||
}
|
||||
|
||||
type SyncTestUser2 struct {
|
||||
Id int64 `xorm:"pk autoincr 'id' comment('primary key 2')"`
|
||||
Name string `xorm:"'name' notnull comment('nickname')" json:"name"`
|
||||
}
|
||||
|
||||
func (m *SyncTestUser2) TableName() string {
|
||||
return "sync_test_user"
|
||||
}
|
||||
|
||||
func TestSync2_3(t *testing.T) {
|
||||
if testEngine.Dialect().URI().DBType == schemas.MYSQL {
|
||||
assert.NoError(t, PrepareEngine())
|
||||
assertSync(t, new(SyncTestUser))
|
||||
|
||||
assert.NoError(t, testEngine.Sync2(new(SyncTestUser2)))
|
||||
tables, err := testEngine.DBMetas()
|
||||
assert.NoError(t, err)
|
||||
tableInfo, err := testEngine.TableInfo(new(SyncTestUser2))
|
||||
|
||||
assert.EqualValues(t, tables[0].GetColumn("id").IsAutoIncrement, tableInfo.GetColumn("id").IsAutoIncrement)
|
||||
assert.EqualValues(t, tables[0].GetColumn("id").Name, tableInfo.GetColumn("id").Name)
|
||||
assert.EqualValues(t, tables[0].GetColumn("id").SQLType.Name, tableInfo.GetColumn("id").SQLType.Name)
|
||||
assert.EqualValues(t, tables[0].GetColumn("id").Nullable, tableInfo.GetColumn("id").Nullable)
|
||||
assert.EqualValues(t, tables[0].GetColumn("id").Comment, tableInfo.GetColumn("id").Comment)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func TestSyncJSON(t *testing.T) {
|
||||
type SyncTestJSON struct {
|
||||
Id int64
|
||||
Value string `xorm:"LONGTEXT JSON 'value' comment('json value')"`
|
||||
}
|
||||
|
||||
assert.NoError(t, PrepareEngine())
|
||||
assertSync(t, new(SyncTestJSON))
|
||||
|
||||
assert.NoError(t, testEngine.Sync(new(SyncTestJSON)))
|
||||
tables, err := testEngine.DBMetas()
|
||||
assert.NoError(t, err)
|
||||
|
||||
tableInfo, err := testEngine.TableInfo(new(SyncTestJSON))
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.EqualValues(t, tables[0].GetColumn("id").IsAutoIncrement, tableInfo.GetColumn("id").IsAutoIncrement)
|
||||
assert.EqualValues(t, tables[0].GetColumn("id").Name, tableInfo.GetColumn("id").Name)
|
||||
if testEngine.Dialect().URI().DBType == schemas.MYSQL {
|
||||
assert.EqualValues(t, tables[0].GetColumn("id").SQLType.Name, tableInfo.GetColumn("id").SQLType.Name)
|
||||
}
|
||||
assert.EqualValues(t, tables[0].GetColumn("id").Nullable, tableInfo.GetColumn("id").Nullable)
|
||||
|
||||
assert.EqualValues(t, tables[0].GetColumn("value").IsAutoIncrement, tableInfo.GetColumn("value").IsAutoIncrement)
|
||||
assert.EqualValues(t, tables[0].GetColumn("value").Name, tableInfo.GetColumn("value").Name)
|
||||
assert.EqualValues(t, tables[0].GetColumn("value").Nullable, tableInfo.GetColumn("value").Nullable)
|
||||
|
||||
if testEngine.Dialect().URI().DBType == schemas.MYSQL {
|
||||
assert.EqualValues(t, tables[0].GetColumn("value").SQLType.Name, tableInfo.GetColumn("value").SQLType.Name)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -899,6 +899,58 @@ func TestFindExtends3(t *testing.T) {
|
|||
assert.EqualValues(t, 2, len(results))
|
||||
}
|
||||
|
||||
func TestFindExtends4(t *testing.T) {
|
||||
type FindExtends4A struct {
|
||||
Id int64
|
||||
Age int
|
||||
Name string
|
||||
}
|
||||
|
||||
type FindExtends4B struct {
|
||||
Id int64
|
||||
ExtId int64 `xorm:"index"`
|
||||
Age int
|
||||
Name string
|
||||
Value int
|
||||
}
|
||||
|
||||
assert.NoError(t, PrepareEngine())
|
||||
assertSync(t, new(FindExtends4A), new(FindExtends4B))
|
||||
|
||||
fe := FindExtends4A{
|
||||
Age: 1,
|
||||
Name: "1",
|
||||
}
|
||||
cnt, err := testEngine.Insert(&fe)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 1, cnt)
|
||||
|
||||
cnt, err = testEngine.Insert(&FindExtends4B{
|
||||
ExtId: fe.Id,
|
||||
Age: 2,
|
||||
Name: "2",
|
||||
Value: 3,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 1, cnt)
|
||||
|
||||
type FindExtends4C struct {
|
||||
FindExtends4A `xorm:"extends"`
|
||||
FindExtends4B `xorm:"extends"`
|
||||
}
|
||||
var results []FindExtends4C
|
||||
err = testEngine.Table("find_extends4_a").
|
||||
Join("INNER", "find_extends4_b", "`find_extends4_b`.`ext_id`=`find_extends4_a`.`id`").
|
||||
Find(&results)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 1, len(results))
|
||||
assert.EqualValues(t, 1, results[0].FindExtends4A.Age)
|
||||
assert.EqualValues(t, "1", results[0].FindExtends4A.Name)
|
||||
assert.EqualValues(t, 2, results[0].FindExtends4B.Age)
|
||||
assert.EqualValues(t, "2", results[0].FindExtends4B.Name)
|
||||
assert.EqualValues(t, 3, results[0].FindExtends4B.Value)
|
||||
}
|
||||
|
||||
func TestFindCacheLimit(t *testing.T) {
|
||||
type InviteCode struct {
|
||||
ID int64 `xorm:"pk autoincr 'id'"`
|
||||
|
|
|
|||
|
|
@ -943,7 +943,7 @@ func TestMultipleInsertTableName(t *testing.T) {
|
|||
assert.NoError(t, testEngine.Table(tableName).Sync(new(NightlyRate)))
|
||||
|
||||
trans := testEngine.NewSession()
|
||||
defer trans.Close()
|
||||
defer func(trans *xorm.Session) { _ = trans.Close() }(trans)
|
||||
err := trans.Begin()
|
||||
assert.NoError(t, err)
|
||||
|
||||
|
|
@ -1031,7 +1031,7 @@ func TestInsertTwice(t *testing.T) {
|
|||
}
|
||||
|
||||
ssn := testEngine.NewSession()
|
||||
defer ssn.Close()
|
||||
defer func(ssn *xorm.Session) { _ = ssn.Close() }(ssn)
|
||||
|
||||
err := ssn.Begin()
|
||||
assert.NoError(t, err)
|
||||
|
|
@ -1209,3 +1209,166 @@ func TestInsertMultipleMap(t *testing.T) {
|
|||
Name: "xiaolunwen",
|
||||
}, res[1])
|
||||
}
|
||||
|
||||
func TestInsertNotDeleted(t *testing.T) {
|
||||
assert.NoError(t, PrepareEngine())
|
||||
zeroTime := time.Date(1, 1, 1, 0, 0, 0, 0, testEngine.GetTZDatabase())
|
||||
type TestInsertNotDeletedStructNotRight struct {
|
||||
ID uint64 `xorm:"'ID' pk autoincr"`
|
||||
DeletedAt time.Time `xorm:"'DELETED_AT' deleted notnull"`
|
||||
}
|
||||
// notnull tag will be ignored
|
||||
err := testEngine.Sync(new(TestInsertNotDeletedStructNotRight))
|
||||
assert.NoError(t, err)
|
||||
|
||||
type TestInsertNotDeletedStruct struct {
|
||||
ID uint64 `xorm:"'ID' pk autoincr"`
|
||||
DeletedAt time.Time `xorm:"'DELETED_AT' deleted"`
|
||||
}
|
||||
|
||||
err = testEngine.Sync(new(TestInsertNotDeletedStruct))
|
||||
assert.NoError(t, err)
|
||||
|
||||
var v1 TestInsertNotDeletedStructNotRight
|
||||
_, err = testEngine.Insert(&v1)
|
||||
assert.NoError(t, err)
|
||||
|
||||
var v2 TestInsertNotDeletedStructNotRight
|
||||
has, err := testEngine.Get(&v2)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, has)
|
||||
assert.Equal(t, v2.DeletedAt.In(testEngine.GetTZDatabase()).Format("2006-01-02 15:04:05"), zeroTime.Format("2006-01-02 15:04:05"))
|
||||
|
||||
var v3 TestInsertNotDeletedStruct
|
||||
_, err = testEngine.Insert(&v3)
|
||||
assert.NoError(t, err)
|
||||
|
||||
var v4 TestInsertNotDeletedStruct
|
||||
has, err = testEngine.Get(&v4)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, has)
|
||||
assert.Equal(t, v4.DeletedAt.In(testEngine.GetTZDatabase()).Format("2006-01-02 15:04:05"), zeroTime.Format("2006-01-02 15:04:05"))
|
||||
}
|
||||
|
||||
func TestInsertNotDeletedNum(t *testing.T) {
|
||||
assert.NoError(t, PrepareEngine())
|
||||
type TestInsertNotDeletedNumStructNotRight struct {
|
||||
ID uint64 `xorm:"'ID' pk autoincr"`
|
||||
DeletedAt int64 `xorm:"'DELETED_AT' deleted notnull INT(11)"`
|
||||
}
|
||||
// notnull tag will be ignored
|
||||
err := testEngine.Sync(new(TestInsertNotDeletedNumStructNotRight))
|
||||
assert.NoError(t, err)
|
||||
|
||||
type TestInsertNotDeletedNumStruct struct {
|
||||
ID uint64 `xorm:"'ID' pk autoincr"`
|
||||
DeletedAt int64 `xorm:"'DELETED_AT' deleted INT(11)"`
|
||||
}
|
||||
|
||||
err = testEngine.Sync(new(TestInsertNotDeletedNumStruct))
|
||||
assert.NoError(t, err)
|
||||
|
||||
var v1 TestInsertNotDeletedNumStructNotRight
|
||||
_, err = testEngine.Insert(&v1)
|
||||
assert.NoError(t, err)
|
||||
|
||||
var v2 TestInsertNotDeletedNumStructNotRight
|
||||
has, err := testEngine.Get(&v2)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, has)
|
||||
assert.Equal(t, v2.DeletedAt, int64(0))
|
||||
|
||||
var v3 TestInsertNotDeletedNumStruct
|
||||
_, err = testEngine.Insert(&v3)
|
||||
assert.NoError(t, err)
|
||||
|
||||
var v4 TestInsertNotDeletedNumStruct
|
||||
has, err = testEngine.Get(&v4)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, has)
|
||||
assert.Equal(t, v4.DeletedAt, int64(0))
|
||||
}
|
||||
|
||||
func TestInsertNotDeletedTimeStamp(t *testing.T) {
|
||||
assert.NoError(t, PrepareEngine())
|
||||
|
||||
// IN MYSQL DB
|
||||
// The time range that timestamps can store is from '1970 01 01 00:00:01.000000' to '2038 01 19 03:14:07.999999'
|
||||
// PASS notnull timestamp IN MYSQL DB
|
||||
if testEngine.Dialect().URI().DBType == schemas.MSSQL ||
|
||||
testEngine.Dialect().URI().DBType == schemas.SQLITE ||
|
||||
testEngine.Dialect().URI().DBType == schemas.POSTGRES {
|
||||
|
||||
type TestInsertNotDeletedTimeStampStructNotRight struct {
|
||||
ID uint64 `xorm:"'ID' pk autoincr"`
|
||||
DeletedAt time.Time `xorm:"'DELETED_AT' deleted notnull TIMESTAMP"`
|
||||
}
|
||||
err := testEngine.Sync(new(TestInsertNotDeletedTimeStampStructNotRight))
|
||||
assert.NoError(t, err)
|
||||
|
||||
var v1 TestInsertNotDeletedTimeStampStructNotRight
|
||||
_, err = testEngine.Insert(&v1)
|
||||
assert.NoError(t, err)
|
||||
|
||||
var v2 TestInsertNotDeletedTimeStampStructNotRight
|
||||
has, err := testEngine.Get(&v2)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, has)
|
||||
assert.Equal(t, v2.DeletedAt, time.Unix(0, 0))
|
||||
}
|
||||
|
||||
type TestInsertNotDeletedTimeStampStruct struct {
|
||||
ID uint64 `xorm:"'ID' pk autoincr"`
|
||||
DeletedAt time.Time `xorm:"'DELETED_AT' deleted TIMESTAMP"`
|
||||
}
|
||||
err := testEngine.Sync(new(TestInsertNotDeletedTimeStampStruct))
|
||||
assert.NoError(t, err)
|
||||
|
||||
var v3 TestInsertNotDeletedTimeStampStruct
|
||||
_, err = testEngine.Insert(&v3)
|
||||
assert.NoError(t, err)
|
||||
|
||||
var v4 TestInsertNotDeletedTimeStampStruct
|
||||
has, err := testEngine.Get(&v4)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, has)
|
||||
assert.Equal(t, v4.DeletedAt, time.Time{})
|
||||
}
|
||||
|
||||
type MyAutoTimeFields1 struct {
|
||||
Id int64
|
||||
Dt time.Time `xorm:"created DATETIME"`
|
||||
}
|
||||
|
||||
func (MyAutoTimeFields1) TableName() string {
|
||||
return "my_auto_time_fields"
|
||||
}
|
||||
|
||||
type MyAutoTimeFields2 struct {
|
||||
Id int64
|
||||
Dt time.Time `xorm:"created"`
|
||||
}
|
||||
|
||||
func (MyAutoTimeFields2) TableName() string {
|
||||
return "my_auto_time_fields"
|
||||
}
|
||||
|
||||
func TestAutoTimeFields(t *testing.T) {
|
||||
assert.NoError(t, PrepareEngine())
|
||||
|
||||
assertSync(t, new(MyAutoTimeFields1))
|
||||
|
||||
_, err := testEngine.Insert(&MyAutoTimeFields1{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
var res []MyAutoTimeFields2
|
||||
assert.NoError(t, testEngine.Find(&res))
|
||||
assert.EqualValues(t, 1, len(res))
|
||||
|
||||
_, err = testEngine.Insert(&MyAutoTimeFields2{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
res = []MyAutoTimeFields2{}
|
||||
assert.NoError(t, testEngine.Find(&res))
|
||||
assert.EqualValues(t, 2, len(res))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,4 +111,25 @@ func TestBufferIterate(t *testing.T) {
|
|||
})
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 10, cnt)
|
||||
|
||||
// test reset statement
|
||||
cnt = 0
|
||||
sess := testEngine.NewSession()
|
||||
defer sess.Close()
|
||||
// generate: SELECT `id`, `is_man` FROM `user_buffer_iterate` WHERE (`id` <= 10) LIMIT 2 OFFSET 10 []
|
||||
err = sess.Where("`id` <= 10").BufferSize(2).Iterate(new(UserBufferIterate), func(i int, bean interface{}) error {
|
||||
user := bean.(*UserBufferIterate)
|
||||
assert.EqualValues(t, cnt+1, user.Id)
|
||||
assert.EqualValues(t, true, user.IsMan)
|
||||
cnt++
|
||||
return nil
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 10, cnt)
|
||||
|
||||
beans := make([]*UserBufferIterate, 0, 10)
|
||||
// generate: SELECT `id`, `is_man` FROM `user_buffer_iterate` WHERE (`id` <= 10) AND (`id` >= 10) LIMIT 2 OFFSET 10 []
|
||||
err = sess.Where("`id` >= 10").Limit(2).Find(&beans)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, beans, 2)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ package tests
|
|||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm/convert"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/names"
|
||||
"xorm.io/xorm/schemas"
|
||||
|
|
@ -1201,8 +1201,10 @@ func TestTagTime(t *testing.T) {
|
|||
has, err = testEngine.Table("tag_u_t_c_struct").Cols("created").Get(&tm)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, has)
|
||||
assert.EqualValues(t, s.Created.UTC().Format("2006-01-02 15:04:05"),
|
||||
strings.ReplaceAll(strings.ReplaceAll(tm, "T", " "), "Z", ""))
|
||||
|
||||
tmTime, err := convert.String2Time(tm, time.UTC, time.UTC)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, s.Created.UTC().Format("2006-01-02 15:04:05"), tmTime.Format("2006-01-02 15:04:05"))
|
||||
}
|
||||
|
||||
func TestTagAutoIncr(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ var (
|
|||
quotePolicyStr = flag.String("quote", "always", "quote could be always, none, reversed")
|
||||
defaultVarchar = flag.String("default_varchar", "varchar", "default varchar type, mssql only, could be varchar or nvarchar, default is varchar")
|
||||
defaultChar = flag.String("default_char", "char", "default char type, mssql only, could be char or nchar, default is char")
|
||||
collation = flag.String("collation", "", "default database collation, it's different for different database")
|
||||
tableMapper names.Mapper
|
||||
colMapper names.Mapper
|
||||
)
|
||||
|
|
@ -55,7 +56,12 @@ func createEngine(dbType, connStr string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err = db.Exec("If(db_id(N'xorm_test') IS NULL) BEGIN CREATE DATABASE xorm_test; END;"); err != nil {
|
||||
createDBSQL := "If(db_id(N'xorm_test') IS NULL) BEGIN CREATE DATABASE xorm_test"
|
||||
if collation != nil && *collation != "" {
|
||||
createDBSQL += fmt.Sprintf(" COLLATE %s", *collation)
|
||||
}
|
||||
createDBSQL += "; END;"
|
||||
if _, err = db.Exec(createDBSQL); err != nil {
|
||||
return fmt.Errorf("db.Exec: %v", err)
|
||||
}
|
||||
db.Close()
|
||||
|
|
|
|||
|
|
@ -619,3 +619,95 @@ func TestMyArray(t *testing.T) {
|
|||
assert.True(t, has)
|
||||
assert.EqualValues(t, v, m.Content)
|
||||
}
|
||||
|
||||
type ZDecimal struct {
|
||||
value *big.Int
|
||||
}
|
||||
|
||||
func (d *ZDecimal) FromDB(data []byte) error {
|
||||
i, _ := strconv.ParseInt(string(data), 10, 64)
|
||||
*d = ZDecimal{
|
||||
value: big.NewInt(i),
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d ZDecimal) ToDB() ([]byte, error) {
|
||||
if d.value == nil {
|
||||
return []byte("0"), nil
|
||||
}
|
||||
return []byte(fmt.Sprintf("%d", (d.value).Int64())), nil
|
||||
}
|
||||
|
||||
func (d ZDecimal) IsZero() bool {
|
||||
if d.value == nil {
|
||||
return true
|
||||
}
|
||||
return d.value.Sign() == 0
|
||||
}
|
||||
|
||||
func (d ZDecimal) String() string {
|
||||
if d.value == nil {
|
||||
return "0"
|
||||
}
|
||||
return d.value.String()
|
||||
}
|
||||
|
||||
func TestZDecimal(t *testing.T) {
|
||||
type ZMyMoney struct {
|
||||
Id int64
|
||||
Account string
|
||||
Amount ZDecimal
|
||||
}
|
||||
|
||||
assert.NoError(t, PrepareEngine())
|
||||
assertSync(t, new(ZMyMoney))
|
||||
|
||||
_, err := testEngine.Insert(&ZMyMoney{
|
||||
Account: "test",
|
||||
Amount: ZDecimal{
|
||||
value: big.NewInt(10000000000000000),
|
||||
},
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
m := ZMyMoney{
|
||||
Id: 1,
|
||||
}
|
||||
has, err := testEngine.Get(&m)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, has)
|
||||
|
||||
_, err = testEngine.Update(&ZMyMoney{
|
||||
Id: 1,
|
||||
Account: "test2",
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
m2 := ZMyMoney{
|
||||
Id: 1,
|
||||
}
|
||||
has, err = testEngine.Get(&m2)
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, has)
|
||||
assert.Equal(t, "test2", "test2")
|
||||
assert.False(t, m2.Amount.IsZero())
|
||||
assert.Equal(t, "10000000000000000", m2.Amount.String())
|
||||
|
||||
_, err = testEngine.AllCols().Update(&ZMyMoney{
|
||||
Id: 1,
|
||||
Account: "test3",
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
var m3 = ZMyMoney{
|
||||
Id: 1,
|
||||
}
|
||||
has, err = testEngine.Get(&m3)
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, has)
|
||||
assert.Equal(t, "test3", "test3")
|
||||
assert.True(t, m3.Amount.IsZero())
|
||||
assert.Equal(t, "0", m3.Amount.String())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue