Coder Social home page Coder Social logo

resp's Introduction

About

This project is a Go package and cli tool called resp for encoding or decoding the redis serialization protocol.

For example, you can pipe stdout to the redis-cli tool to take advantage of redis pipelining, which is a very efficient way to execute large amounts of commands against redis:

$ for i in {1..1000}; do echo -n "LPUSH counts $i" | resp; done | redis-cli --pipe
All data transferred. Waiting for the last reply...
Last reply received from server.
errors: 0, replies: 1000

Installation

go get -u github.com/kevin-cantwell/resp/...

CLI Usage

Encoding

The default usage is to encode stdin (note that quoted strings are parsed as a single field).

command:

$ resp

stdin:

SET foo "biz\nbaz buz"

stdout (escaped for readability):

*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$11\r\nbiz\nbaz buz\r\n

Decoding

When decoding, the default is to use human-friendly output. The --raw flag may be passed in to get just the decoded text value and nothing more.

command:

$ resp --decode

stdin:

*4
+OK
-ERR foo
:123
$3
bar

stdout:

1) OK
2) (error) ERR foo
3) 123
4) "bar"

stdout with --raw option:

OK
ERR foo
123
bar

Go Package

The Go Package provides reader and writer types. See Godocs: https://godoc.org/github.com/kevin-cantwell/resp

resp's People

Contributors

kevin-cantwell avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.