master
李光春 2 years ago
parent 1739fc2e85
commit d35458d831

@ -0,0 +1,23 @@
package dingdanxia
import (
"log"
"testing"
"github.com/dtapps/go-library/utils/gotime"
)
var app = App{
ApiKey: "ZTe5tqKhIc6nm8HkJkqj5hmpmAjs1WTy",
}
func TestApp(t *testing.T) {
param := NewParams()
param.Set("start_time", gotime.Current().BeforeDay(28).Timestamp())
param.Set("end_time", gotime.Current().Timestamp())
res, err := app.WaimaiMeituanOrders(param)
log.Println(res)
log.Printf("%s\n", res)
log.Printf("%v\n", res)
log.Println(err)
}

@ -0,0 +1,62 @@
package goredis
import (
"testing"
)
func TestSet(t *testing.T) {
//// 连接
//err := InitRedis("127.0.0.1", 6379, "", 2)
//if err != nil {
// fmt.Printf("err%v\n", err)
//}
//// 设置
//NewStringOperation().Set("test", "test", WithExpire(time.Second*1))
}
func TestMGet(t *testing.T) {
//// 连接
//err := InitRedis("127.0.0.1", 6379, "", 2)
//if err != nil {
// fmt.Printf("err%v\n", err)
//}
//// 获取
//iter := NewStringOperation().MGet("test1", "test2").Iter()
//for iter.HasNext() {
// fmt.Println("MGet", iter.Next())
//}
}
func TestJson(t *testing.T) {
//// 连接
//err := InitRedis("127.0.0.1", 6379, "", 2)
//if err != nil {
// fmt.Printf("err%v\n", err)
//}
//newCache := NewSimpleCache(NewStringOperation(), time.Second*10, SerializerJson)
//newCache.JsonGetter = func() interface{} {
// fmt.Println("【没有命中】SerializerJson")
// type a []string
// b := a{
// "me", "she", "you",
// }
// return b
//}
//cacheJSon := newCache.GetCache("test123")
//fmt.Printf("【GetCache】cacheJSon%v\n", cacheJSon)
}
func TestDbString(t *testing.T) {
//// 连接
//err := InitRedis("127.0.0.1", 6379, "", 2)
//if err != nil {
// fmt.Printf("err%v\n", err)
//}
//newCache := NewSimpleCache(NewStringOperation(), time.Second*10, SerializerString)
//newCache.DBGetter = func() string {
// fmt.Println("【没有命中】SerializerString")
// return "data by id=123"
//}
//cacheString := newCache.GetCache("test456")
//fmt.Printf("【GetCache】cacheString%v\n", cacheString)
}

@ -0,0 +1,9 @@
package gossh
import (
"testing"
)
func TestClient(t *testing.T) {
//Tunnel("root", "", ":22", ":3306", "localhost:13306")
}

@ -1,84 +0,0 @@
package redis
import (
"fmt"
"github.com/bitly/go-simplejson"
"testing"
"time"
)
func TestName(t *testing.T) {
}
func client() {
// 连接
err := InitRedis("127.0.0.1", 6379, "", 2)
if err != nil {
fmt.Printf("err%v\n", err)
}
jsonSimpleJson()
}
func set() {
// 设置
NewStringOperation().Set("test", "test", WithExpire(time.Second*1))
}
func mGet() {
// 获取
iter := NewStringOperation().MGet("test1", "test2").Iter()
for iter.HasNext() {
fmt.Println("MGet", iter.Next())
}
}
func json() {
newCache := NewSimpleCache(NewStringOperation(), time.Second*10, SerializerJson)
newCache.JsonGetter = func() interface{} {
fmt.Println("【没有命中】SerializerJson")
type a []string
b := a{
"me", "she", "you",
}
return b
}
cacheJSon := newCache.GetCache("test123")
fmt.Printf("【GetCache】cacheJSon%v\n", cacheJSon)
}
func dbString() {
newCache := NewSimpleCache(NewStringOperation(), time.Second*10, SerializerString)
newCache.DBGetter = func() string {
fmt.Println("【没有命中】SerializerString")
return "data by id=123"
}
cacheString := newCache.GetCache("test456")
fmt.Printf("【GetCache】cacheString%v\n", cacheString)
}
func simpleJson() {
newCache := NewSimpleCache(NewStringOperation(), time.Second*50, SerializerSimpleJson)
newCache.SimpleJsonGetter = func() *simplejson.Json {
fmt.Println("_test【没有命中】SerializerSimpleJson")
js := simplejson.New()
js.Set("name", "test")
return js
}
cacheSimpleJson := newCache.GetCacheSimpleJson("test789")
fmt.Printf("_test【GetCache】cacheSimpleJson%v\n", cacheSimpleJson.Get("name"))
}
func jsonSimpleJson() {
newCache := NewSimpleCache(NewStringOperation(), time.Second*50, SerializerJson)
newCache.JsonGetter = func() interface{} {
fmt.Println("【没有命中】SerializerJson")
type a []string
b := a{
"me", "she", "you",
}
return b
}
cacheJson := newCache.GetCacheSimpleJson("test789")
fmt.Printf("_test【JsonGetter GetCacheSimpleJson】jsonSimpleJson%v\n", cacheJson.GetIndex(1))
}

@ -1,13 +0,0 @@
package ssh
import (
"testing"
)
func TestName(t *testing.T) {
}
func client() {
Tunnel("root", "", ":22", ":3306", "localhost:13306")
}

@ -14,8 +14,3 @@ func TestDeCode(t *testing.T) {
u := "https%3A%2F%2Fwww.dtapp.net"
fmt.Println(DeCode(u))
}
func TestParseQuery(t *testing.T) {
u := "https://api.dtapp.net/v8/ip/qqwry?ip=113.118.170.199"
fmt.Println(ParseQuery(u))
}

Loading…
Cancel
Save