|
|
@ -8,28 +8,28 @@ import (
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type Miaomiao struct {
|
|
|
|
type Miaomiao struct {
|
|
|
|
Sakura string
|
|
|
|
Val1 string
|
|
|
|
Fuck int
|
|
|
|
Val2 int
|
|
|
|
Mimi bool
|
|
|
|
Val3 bool
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func Test_Remote(t *testing.T) {
|
|
|
|
func Test_Remote(t *testing.T) {
|
|
|
|
Store("nmb", 22222)
|
|
|
|
Store("test", 22222)
|
|
|
|
server, _ := NewServer("tcp", "127.0.0.1:45678")
|
|
|
|
server, _ := NewServer("tcp", "127.0.0.1:45678")
|
|
|
|
server.Register(&Miaomiao{})
|
|
|
|
server.Register(&Miaomiao{})
|
|
|
|
client, _ := NewClient("tcp", "127.0.0.1:45678", time.Second*2)
|
|
|
|
client, _ := NewClient("tcp", "127.0.0.1:45678", time.Second*2)
|
|
|
|
_ = server
|
|
|
|
_ = server
|
|
|
|
fmt.Println(client.Get("maio"))
|
|
|
|
fmt.Println(client.Get("meow"))
|
|
|
|
fmt.Println(client.Exists("maio"))
|
|
|
|
fmt.Println(client.Exists("meow"))
|
|
|
|
fmt.Println(client.Store("maio", Miaomiao{"sss", 222, true}))
|
|
|
|
fmt.Println(client.Store("meow", Miaomiao{"sss", 222, true}))
|
|
|
|
fmt.Println(client.Get("maio"))
|
|
|
|
fmt.Println(client.Get("meow"))
|
|
|
|
fmt.Println(client.Exists("maio"))
|
|
|
|
fmt.Println(client.Exists("meow"))
|
|
|
|
fmt.Println(client.Delete("maio"))
|
|
|
|
fmt.Println(client.Delete("meow"))
|
|
|
|
fmt.Println(client.Exists("maio"))
|
|
|
|
fmt.Println(client.Exists("meow"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (cat *Miaomiao) GetName() string {
|
|
|
|
func (cat *Miaomiao) GetName() string {
|
|
|
|
return "miaomiao"
|
|
|
|
return "meow"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func Test_Math(t *testing.T) {
|
|
|
|
func Test_Math(t *testing.T) {
|
|
|
|