1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-26 19:21:03 +03:00

feat: add WriteArg and Scan net.IP(#2062)

* feat: add WriteArg net.IP

* feat: add Scan net.IP
This commit is contained in:
Sown
2022-03-28 09:16:12 +08:00
committed by GitHub
parent 3961b9577f
commit 7d5167e862
4 changed files with 28 additions and 0 deletions

View File

@ -316,6 +316,18 @@ var _ = Describe("Client", func() {
err := client.Conn(ctx).Get(ctx, "this-key-does-not-exist").Err()
Expect(err).To(Equal(redis.Nil))
})
It("should set and scan net.IP", func() {
ip := net.ParseIP("192.168.1.1")
err := client.Set(ctx, "ip", ip, 0).Err()
Expect(err).NotTo(HaveOccurred())
var ip2 net.IP
err = client.Get(ctx, "ip").Scan(&ip2)
Expect(err).NotTo(HaveOccurred())
Expect(ip2).To(Equal(ip))
})
})
var _ = Describe("Client timeout", func() {