Merge pull request #4461 from jianzhiyao/frt/delete-txorm
make ormer open by QueryExecutor
This commit is contained in:
commit
c41f6dd17b
@ -58,7 +58,7 @@ before_install:
|
|||||||
install:
|
install:
|
||||||
- go get -u honnef.co/go/tools/cmd/staticcheck
|
- go get -u honnef.co/go/tools/cmd/staticcheck
|
||||||
- go get -u github.com/mdempsky/unconvert
|
- go get -u github.com/mdempsky/unconvert
|
||||||
- go get -u github.com/gordonklaus/ineffassign
|
- go get -u github.com/gordonklaus/ineffassign
|
||||||
before_script:
|
before_script:
|
||||||
|
|
||||||
# -
|
# -
|
||||||
@ -80,6 +80,6 @@ script:
|
|||||||
- staticcheck -show-ignored -checks "-ST1017,-U1000,-ST1005,-S1034,-S1012,-SA4006,-SA6005,-SA1019,-SA1024" ./
|
- staticcheck -show-ignored -checks "-ST1017,-U1000,-ST1005,-S1034,-S1012,-SA4006,-SA6005,-SA1019,-SA1024" ./
|
||||||
- unconvert $(go list ./... | grep -v /vendor/)
|
- unconvert $(go list ./... | grep -v /vendor/)
|
||||||
- ineffassign .
|
- ineffassign .
|
||||||
- find . ! \( -path './vendor' -prune \) -type f -name '*.go' -print0 | xargs -0 gofmt -l -s
|
- find . ! \( -path './vendor' -prune \) -type f -name '*.go' -print0 | xargs -0 gofmt -l -s
|
||||||
addons:
|
addons:
|
||||||
postgresql: "9.6"
|
postgresql: "9.6"
|
||||||
|
|||||||
@ -17,4 +17,6 @@
|
|||||||
- Fix 4444: panic when 404 not found. [4446](https://github.com/beego/beego/pull/4446)
|
- Fix 4444: panic when 404 not found. [4446](https://github.com/beego/beego/pull/4446)
|
||||||
- Fix 4435: fix panic when controller dir not found. [4452](https://github.com/beego/beego/pull/4452)
|
- Fix 4435: fix panic when controller dir not found. [4452](https://github.com/beego/beego/pull/4452)
|
||||||
- Fix 4456: Fix router method expression [4456](https://github.com/beego/beego/pull/4456)
|
- Fix 4456: Fix router method expression [4456](https://github.com/beego/beego/pull/4456)
|
||||||
- Remove some `go get` lines in `.travis.yml` file [4469](https://github.com/beego/beego/pull/4469)
|
- Remove some `go get` lines in `.travis.yml` file [4469](https://github.com/beego/beego/pull/4469)
|
||||||
|
- Fix 4451: support QueryExecutor interface. [4461](https://github.com/beego/beego/pull/4461)
|
||||||
|
- Add some testing scripts [4461](https://github.com/beego/beego/pull/4461)
|
||||||
|
|||||||
@ -36,7 +36,7 @@ We provide docker compose file to start all middlewares.
|
|||||||
You can run:
|
You can run:
|
||||||
|
|
||||||
```shell script
|
```shell script
|
||||||
docker-compose -f scripts/test_docker_compose.yml up -d
|
docker-compose -f scripts/test_docker_compose.yaml up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
Unit tests read addresses from environment, here is an example:
|
Unit tests read addresses from environment, here is an example:
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# Beego [](https://travis-ci.org/astaxie/beego) [](http://godoc.org/github.com/beego/beego/v2) [](http://golangfoundation.org) [](https://goreportcard.com/report/github.com/beego/beego/v2)
|
# Beego [](https://travis-ci.org/beego/beego) [](http://godoc.org/github.com/beego/beego) [](http://golangfoundation.org) [](https://goreportcard.com/report/github.com/beego/beego)
|
||||||
|
|
||||||
Beego is used for rapid development of enterprise application in Go, including RESTful APIs, web apps and backend
|
Beego is used for rapid development of enterprise application in Go, including RESTful APIs, web apps and backend
|
||||||
services.
|
services.
|
||||||
|
|||||||
@ -216,19 +216,25 @@ type DriverGetter interface {
|
|||||||
Driver() Driver
|
Driver() Driver
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type ormer interface {
|
type ormer interface {
|
||||||
DQL
|
DQL
|
||||||
DML
|
DML
|
||||||
DriverGetter
|
DriverGetter
|
||||||
}
|
}
|
||||||
|
|
||||||
type Ormer interface {
|
//QueryExecutor wrapping for ormer
|
||||||
|
type QueryExecutor interface {
|
||||||
ormer
|
ormer
|
||||||
|
}
|
||||||
|
|
||||||
|
type Ormer interface {
|
||||||
|
QueryExecutor
|
||||||
TxBeginner
|
TxBeginner
|
||||||
}
|
}
|
||||||
|
|
||||||
type TxOrmer interface {
|
type TxOrmer interface {
|
||||||
ormer
|
QueryExecutor
|
||||||
TxCommitter
|
TxCommitter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
8
scripts/prepare_etcd.sh
Normal file
8
scripts/prepare_etcd.sh
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
etcdctl put current.float 1.23
|
||||||
|
etcdctl put current.bool true
|
||||||
|
etcdctl put current.int 11
|
||||||
|
etcdctl put current.string hello
|
||||||
|
etcdctl put current.serialize.name test
|
||||||
|
etcdctl put sub.sub.key1 sub.sub.key
|
||||||
17
scripts/test.sh
Normal file
17
scripts/test.sh
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker-compose -f "$(pwd)/scripts/test_docker_compose.yaml" up -d
|
||||||
|
|
||||||
|
export ORM_DRIVER=mysql
|
||||||
|
export TZ=UTC
|
||||||
|
export ORM_SOURCE="beego:test@tcp(localhost:13306)/orm_test?charset=utf8"
|
||||||
|
|
||||||
|
# wait for services in images ready
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
go test "$(pwd)/..."
|
||||||
|
|
||||||
|
# clear all container
|
||||||
|
docker-compose -f "$(pwd)/scripts/test_docker_compose.yaml" down
|
||||||
|
|
||||||
|
|
||||||
55
scripts/test_docker_compose.yaml
Normal file
55
scripts/test_docker_compose.yaml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
redis:
|
||||||
|
container_name: "beego-redis"
|
||||||
|
image: redis
|
||||||
|
environment:
|
||||||
|
- ALLOW_EMPTY_PASSWORD=yes
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
|
||||||
|
mysql:
|
||||||
|
container_name: "beego-mysql"
|
||||||
|
image: mysql:5.7.30
|
||||||
|
ports:
|
||||||
|
- "13306:3306"
|
||||||
|
environment:
|
||||||
|
- MYSQL_ROOT_PASSWORD=1q2w3e
|
||||||
|
- MYSQL_DATABASE=orm_test
|
||||||
|
- MYSQL_USER=beego
|
||||||
|
- MYSQL_PASSWORD=test
|
||||||
|
|
||||||
|
postgresql:
|
||||||
|
container_name: "beego-postgresql"
|
||||||
|
image: bitnami/postgresql:latest
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
environment:
|
||||||
|
- ALLOW_EMPTY_PASSWORD=yes
|
||||||
|
ssdb:
|
||||||
|
container_name: "beego-ssdb"
|
||||||
|
image: wendal/ssdb
|
||||||
|
ports:
|
||||||
|
- "8888:8888"
|
||||||
|
memcache:
|
||||||
|
container_name: "beego-memcache"
|
||||||
|
image: memcached
|
||||||
|
ports:
|
||||||
|
- "11211:11211"
|
||||||
|
etcd:
|
||||||
|
command: >
|
||||||
|
sh -c "
|
||||||
|
etcdctl put current.float 1.23
|
||||||
|
&& etcdctl put current.bool true
|
||||||
|
&& etcdctl put current.int 11
|
||||||
|
&& etcdctl put current.string hello
|
||||||
|
&& etcdctl put current.serialize.name test
|
||||||
|
"
|
||||||
|
container_name: "beego-etcd"
|
||||||
|
environment:
|
||||||
|
- ALLOW_NONE_AUTHENTICATION=yes
|
||||||
|
# - ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
|
||||||
|
image: bitnami/etcd
|
||||||
|
ports:
|
||||||
|
- "2379:2379"
|
||||||
|
- "2380:2380"
|
||||||
Loading…
x
Reference in New Issue
Block a user