github.com/hdt3213/godis@v1.2.9/redis/protocol/consts.go (about) 1 package protocol 2 3 // PongReply is +PONG 4 type PongReply struct{} 5 6 var pongBytes = []byte("+PONG\r\n") 7 8 // ToBytes marshal redis.Reply 9 func (r *PongReply) ToBytes() []byte { 10 return pongBytes 11 } 12 13 // OkReply is +OK 14 type OkReply struct{} 15 16 var okBytes = []byte("+OK\r\n") 17 18 // ToBytes marshal redis.Reply 19 func (r *OkReply) ToBytes() []byte { 20 return okBytes 21 } 22 23 var theOkReply = new(OkReply) 24 25 // MakeOkReply returns a ok protocol 26 func MakeOkReply() *OkReply { 27 return theOkReply 28 } 29 30 var nullBulkBytes = []byte("$-1\r\n") 31 32 // NullBulkReply is empty string 33 type NullBulkReply struct{} 34 35 // ToBytes marshal redis.Reply 36 func (r *NullBulkReply) ToBytes() []byte { 37 return nullBulkBytes 38 } 39 40 // MakeNullBulkReply creates a new NullBulkReply 41 func MakeNullBulkReply() *NullBulkReply { 42 return &NullBulkReply{} 43 } 44 45 var emptyMultiBulkBytes = []byte("*0\r\n") 46 47 // EmptyMultiBulkReply is a empty list 48 type EmptyMultiBulkReply struct{} 49 50 // ToBytes marshal redis.Reply 51 func (r *EmptyMultiBulkReply) ToBytes() []byte { 52 return emptyMultiBulkBytes 53 } 54 55 // MakeEmptyMultiBulkReply creates EmptyMultiBulkReply 56 func MakeEmptyMultiBulkReply() *EmptyMultiBulkReply { 57 return &EmptyMultiBulkReply{} 58 } 59 60 // NoReply respond nothing, for commands like subscribe 61 type NoReply struct{} 62 63 var noBytes = []byte("") 64 65 // ToBytes marshal redis.Reply 66 func (r *NoReply) ToBytes() []byte { 67 return noBytes 68 } 69 70 // QueuedReply is +QUEUED 71 type QueuedReply struct{} 72 73 var queuedBytes = []byte("+QUEUED\r\n") 74 75 // ToBytes marshal redis.Reply 76 func (r *QueuedReply) ToBytes() []byte { 77 return queuedBytes 78 } 79 80 var theQueuedReply = new(QueuedReply) 81 82 // MakeQueuedReply returns a QUEUED protocol 83 func MakeQueuedReply() *QueuedReply { 84 return theQueuedReply 85 }