BytesArray replies a [][]byte when commit
(w io.Writer, a [][]byte)
| 60 | |
| 61 | // BytesArray replies a [][]byte when commit |
| 62 | func BytesArray(w io.Writer, a [][]byte) OnCommit { |
| 63 | return func() { |
| 64 | start := time.Now() |
| 65 | resp.ReplyArray(w, len(a)) |
| 66 | zap.L().Debug("reply array size", zap.Int64("cost(us)", time.Since(start).Nanoseconds()/1000)) |
| 67 | start = time.Now() |
| 68 | for i := range a { |
| 69 | if a[i] == nil { |
| 70 | resp.ReplyNullBulkString(w) |
| 71 | continue |
| 72 | } |
| 73 | resp.ReplyBulkString(w, string(a[i])) |
| 74 | if i % 10 == 9 { |
| 75 | zap.L().Debug("reply 10 bulk string", zap.Int64("cost(us)", time.Since(start).Nanoseconds()/1000)) |
| 76 | start = time.Now() |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | // TxnCommand runs a command in transaction |
| 83 | type TxnCommand func(ctx *Context, txn *db.Transaction) (OnCommit, error) |
no test coverage detected