Skip to content

Commit dbfb349

Browse files
committed
[test] Shared test file
1 parent 9b9c9b7 commit dbfb349

File tree

1 file changed

+36
-0
lines changed
  • go/ql/test/library-tests/semmle/go/dataflow/flowsources/local/database

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package test
2+
3+
import (
4+
"fmt"
5+
6+
gocb "github.com/couchbase/gocb/v2"
7+
"github.com/gogf/gf/database/gdb"
8+
)
9+
10+
func gogf(g gdb.DB) {
11+
u1, err := g.GetOne("SELECT user from users") // $source
12+
13+
if err != nil {
14+
return
15+
}
16+
17+
fmt.Println(u1)
18+
}
19+
20+
func couchbase(coll *gocb.Collection) {
21+
type User struct {
22+
Name string
23+
}
24+
25+
var user User
26+
27+
result, err := coll.Get("documentID", nil) // $source
28+
29+
if err != nil {
30+
return
31+
}
32+
33+
result.Content(&user)
34+
35+
fmt.Println(user)
36+
}

0 commit comments

Comments
 (0)