Merge pull request #4461 from jianzhiyao/frt/delete-txorm

make ormer open by QueryExecutor
This commit is contained in:
Ming Deng 2021-01-29 18:19:44 +08:00 committed by GitHub
commit c41f6dd17b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 95 additions and 7 deletions

View File

@ -18,3 +18,5 @@
- 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)

View File

@ -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:

View File

@ -1,4 +1,4 @@
# Beego [![Build Status](https://travis-ci.org/astaxie/beego.svg?branch=master)](https://travis-ci.org/astaxie/beego) [![GoDoc](http://godoc.org/github.com/beego/beego/v2?status.svg)](http://godoc.org/github.com/beego/beego/v2) [![Foundation](https://img.shields.io/badge/Golang-Foundation-green.svg)](http://golangfoundation.org) [![Go Report Card](https://goreportcard.com/badge/github.com/beego/beego/v2)](https://goreportcard.com/report/github.com/beego/beego/v2) # Beego [![Build Status](https://travis-ci.org/beego/beego.svg?branch=master)](https://travis-ci.org/beego/beego) [![GoDoc](http://godoc.org/github.com/beego/beego?status.svg)](http://godoc.org/github.com/beego/beego) [![Foundation](https://img.shields.io/badge/Golang-Foundation-green.svg)](http://golangfoundation.org) [![Go Report Card](https://goreportcard.com/badge/github.com/beego/beego)](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.

View File

@ -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
View 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
View 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

View 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"