sqlite的api,便于内部使用
liuxiaolong
2019-11-14 a251b5d8b758ed7c43eff07b71af9881f4a4c9b5
soApi.go
@@ -4,13 +4,30 @@
   "basic.com/pubsub/protomsg.git"
   "encoding/json"
   "fmt"
   "strconv"
)
type SoApi struct {}
type SoApi struct {
   Ip string
   Port int
}
func (api SoApi) getBasicUrl() string {
   if api.Ip == "" {
      return BASIC_URL
   }
   if api.Ip == "" {
      api.Ip = DEFAULT_IP
   }
   if api.Port == 0 {
      api.Port = DEFAULT_PORT
   }
   return "http://"+api.Ip+":"+strconv.Itoa(api.Port)
}
//获取所有sdkId与soName映射信息
func (api SoApi) FindAll() (soInfos []protomsg.SoInfo) {
   url := BASIC_URL + DATA_URL_PREFIX + "/so/findAll"
   url := api.getBasicUrl() + DATA_URL_PREFIX + "/so/findAll"
   client := NewClient()
   respBody, err := client.DoGetRequest(url, nil, nil)
@@ -28,7 +45,7 @@
}
func (api SoApi) Add(paramBody map[string]interface{}) (bool,interface{}) {
   url := BASIC_URL + DATA_URL_PREFIX + "/so/addSo"
   url := api.getBasicUrl() + DATA_URL_PREFIX + "/so/addSo"
   client := NewClient()
   respBody, err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody, nil, nil)
   if err != nil {