u
This commit is contained in:
1 parent
7552670e4a
commit
01ea998605
13 files changed
+173
-45
No files matched your search
@@ -2,9 +2,27 @@ package handle
|
||||
|
||||
import (
|
||||
"base-framework/pkg/router"
|
||||
"base-framework/pkg/utils/db"
|
||||
"base-framework/pkg/utils/response"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func Test(c *router.Context) {
|
||||
response.Success(c).Send()
|
||||
dbClient := db.NewClient(c)
|
||||
if dbClient == nil {
|
||||
return
|
||||
}
|
||||
|
||||
sqlStr := "SELECT id, name FROM user"
|
||||
rows, err := dbClient.QueryRows(sqlStr)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, row := range rows {
|
||||
fmt.Println(row["id"], row["name"])
|
||||
}
|
||||
|
||||
response.Success(c).Data(rows).Send()
|
||||
}
|
||||
Reference in new issue
Block a user