aboutsummaryrefslogtreecommitdiff
path: root/pkg/commands/discard.go
blob: e96d2c034d95301ba1052df555e6f721d5304a8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package commands

import (
	"errors"
	"net"
	"redisClone/pkg/core"
)

func Discard(db core.RedisDB, session *ClientSession, conn net.Conn, execArgs []string) interface{} {
	if !session.InTransaction {
		return errors.New("DISCARD without MULTI")
	}

	session.InTransaction = false
	session.Queue = nil

	return core.SimpleString("OK")
}