Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit e19f476

Browse files
committed
Add test for Sqlx
1 parent f5caf7e commit e19f476

File tree

6 files changed

+637
-0
lines changed

6 files changed

+637
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module gormtest
2+
3+
go 1.14
4+
5+
require (
6+
github.com/jmoiron/sqlx v1.2.0
7+
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
| sqlx.go:15:17:15:25 | untrusted |
2+
| sqlx.go:16:14:16:22 | untrusted |
3+
| sqlx.go:17:14:17:22 | untrusted |
4+
| sqlx.go:18:12:18:20 | untrusted |
5+
| sqlx.go:19:15:19:23 | untrusted |
6+
| sqlx.go:20:16:20:24 | untrusted |
7+
| sqlx.go:23:17:23:25 | untrusted |
8+
| sqlx.go:24:14:24:22 | untrusted |
9+
| sqlx.go:25:14:25:22 | untrusted |
10+
| sqlx.go:26:12:26:20 | untrusted |
11+
| sqlx.go:27:15:27:23 | untrusted |
12+
| sqlx.go:28:16:28:24 | untrusted |
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package sqlxtest
2+
3+
import (
4+
"github.com/jmoiron/sqlx"
5+
)
6+
7+
func getUntrustedString() string {
8+
return "trouble"
9+
}
10+
11+
func main() {
12+
13+
db := sqlx.DB{}
14+
untrusted := getUntrustedString()
15+
db.Select(nil, untrusted)
16+
db.Get(nil, untrusted)
17+
db.MustExec(untrusted)
18+
db.Queryx(untrusted)
19+
db.NamedExec(untrusted, nil)
20+
db.NamedQuery(untrusted, nil)
21+
22+
tx := sqlx.Tx{}
23+
tx.Select(nil, untrusted)
24+
tx.Get(nil, untrusted)
25+
tx.MustExec(untrusted)
26+
tx.Queryx(untrusted)
27+
tx.NamedExec(untrusted, nil)
28+
tx.NamedQuery(untrusted, nil)
29+
30+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import go
2+
3+
from SQL::QueryString qs
4+
select qs

0 commit comments

Comments
 (0)