sqlite的api,便于内部使用
liuxiaolong
2019-06-24 97387b6eb3cfae3ed1d1d97b51fa618af20fbb68
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
package dbapi
 
import (
    "encoding/json"
    "fmt"
)
 
type EventPushApi struct {
 
}
 
func (api EventPushApi) Save(paramBody map[string]interface{}) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/eventPush/save"
    client := NewClient()
    body,err := client.DoPostRequest(url,CONTENT_TYPE_JSON, paramBody,nil,nil)
    if err != nil {
        return false,nil
    }
 
    var res Result
    if err = json.Unmarshal(body, &res); err != nil {
        fmt.Println(err)
        return false,nil
    }
 
    return res.Success,res.Data
}
 
func (api EventPushApi) FindByEventTopic(topic string,childType string) (bool,interface{}){
    url := BASIC_URL + DATA_URL_PREFIX + "/eventPush/findByEventTopic"
    client := NewClient()
    paramQuery :=make(map[string]string,0)
    paramQuery["topic"] = topic
    paramQuery["childType"] = childType
    body, err := client.DoGetRequest(url, paramQuery, nil)
    if err != nil {
        return false,nil
    }
 
    var res Result
    if err = json.Unmarshal(body, &res); err != nil {
        return false,nil
    }
    return true,res.Data
}