-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathfunc_LComment.go
87 lines (80 loc) · 1.94 KB
/
func_LComment.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package main
import (
"net/http"
)
/**
type LghRequest struct {
w http.ResponseWriter
r *http.Request
funcName string
inputStruct interface{}
slicesCallBack func(slices *[]interface{}) bool
getSqlCallBack func(slices *[]interface{},inputStruct interface{}) string
}
r.HandleFunc("/insert_lcomment",insert_lcomment)
r.HandleFunc("/delete_lcomment",delete_lcomment)
r.HandleFunc("/update_lcomment",update_lcomment)
r.HandleFunc("/select_lcomment",select_lcomment)
*/
func insert_lcomment(w http.ResponseWriter,r *http.Request) {
request := LghRequest{
w,
r,
"insert_lcomment",
new (LComment),
func(slices []interface{}) bool{
return false
},
func(slices []interface{},inputStruct interface{}) string {
return buildInsertSqlByStruct(new (LComment),"LComment")
}}
insertDataByStruct(request)
}
func delete_lcomment(w http.ResponseWriter,r *http.Request) {
request := LghRequest{
w,
r,
"delete_lcomment",
nil,
func(slices []interface{}) bool{
return false
},
func(slices []interface{},inputStruct interface{}) string {
return "delete from LComment where id='2'"
}}
deleteDataByStruct(request)
}
func update_lcomment(w http.ResponseWriter,r *http.Request) {
type testS struct {
Id int64 `json:"id" nullTag:"1"`
}
request := LghRequest{
w,
r,
"update_lcomment",
new (testS),
func(slices []interface{}) bool{
// 演示使用输入参数的情况
return false
},
func(slices []interface{},inputStruct interface{}) string {
return "update LComment set u_user_id='444' where id=?"
}}
updateDataByStruct(request)
}
func select_lcomment(w http.ResponseWriter,r *http.Request) {
request := LghRequest{
w,
r,
"select_lcomment",
nil,
func(slices []interface{}) bool{
// 演示使用输入参数的情况
return false
},
func(slices []interface{},inputStruct interface{}) string {
return "select * from LComment"
}}
output := new (LComment)
selectDataByStruct(request,output)
}