sqlite的api,便于内部使用
liuxiaolong
2021-01-12 774158ff1644cacc279d84115cc8aaeb40589ce3
client.go
@@ -1,6 +1,9 @@
package dbapi
import "strconv"
import (
   "fmt"
   "strconv"
)
type Client interface {
   //GET
@@ -10,7 +13,7 @@
   //PUT
   DoPutRequest(url string, contentType string, body map[string]interface{}, headers map[string]string) ([]byte, error)
   //DELETE
   DoDeleteRequest(url string, contentType string, body map[string]interface{}, headers map[string]string) ([]byte, error)
   DoDeleteRequest(url string, contentType string, body map[string]interface{}, params map[string]string, headers map[string]string) ([]byte, error)
}
var BASIC_URL            = "http://127.0.0.1:8001"
@@ -25,7 +28,16 @@
   CONTENT_TYPE_JSON    = "application/json"
)
var logPrint = func(i ...interface{}) {
   fmt.Println(i)
}
//初始化dbserver的地址和端口
func Init(ip string,port int){
   BASIC_URL = "http://"+ ip + ":" + strconv.Itoa(port)
}
func InitLog(fn func(i ...interface{})) {
   if fn != nil {
      logPrint = fn
   }
}