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

Tweak transaction API.

This commit is contained in:
Vladimir Mihailenco
2016-05-02 15:54:15 +03:00
parent 033a4de2fb
commit 092698ecd3
8 changed files with 138 additions and 161 deletions

View File

@ -37,18 +37,19 @@ var _ = Describe("pool", func() {
perform(1000, func(id int) {
var ping *redis.StatusCmd
tx, err := client.Watch()
Expect(err).NotTo(HaveOccurred())
cmds, err := tx.Exec(func() error {
ping = tx.Ping()
return nil
err := client.Watch(func(tx *redis.Tx) error {
cmds, err := tx.MultiExec(func() error {
ping = tx.Ping()
return nil
})
Expect(err).NotTo(HaveOccurred())
Expect(cmds).To(HaveLen(1))
return err
})
Expect(err).NotTo(HaveOccurred())
Expect(cmds).To(HaveLen(1))
Expect(ping.Err()).NotTo(HaveOccurred())
Expect(ping.Val()).To(Equal("PONG"))
Expect(tx.Close()).NotTo(HaveOccurred())
})
pool := client.Pool()