只要实现了Sortable接口的所有方法,就可以使用该接口的函数. 我们通过冒泡排序来演示一下: package main import "fmt" type Sortable interface { Len() int Less(int, int) bool Swap(int, int) } func Mysort(s Sortable) { l := s.Len() for x := 0; x < l; x++ { for y := 0; y < l-x-1; y++…
c := redisPool.Get() psc := redis.PubSubConn{c} psc.PSubscribe("aa*") for { switch v := psc.Receive().(type) { case redis.Subscription: fmt.Printf("%s: %s %d\n", v.Channel, v.Kind, v.Count) case redis.Message://单个订阅subscribe fmt.Printf…