Permalink
Browse files

documented the "typename" method and various constants.

  • Loading branch information...
1 parent 9332b2f commit 2f302a67a5d162c94129adaf6206fc6e3d9ce170 @agentzh agentzh committed Aug 28, 2011
Showing with 125 additions and 7 deletions.
  1. +38 −3 README
  2. +48 −2 README.markdown
  3. +39 −2 doc/LuaRedisParser.wiki
View
41 README
@@ -3,8 +3,8 @@ NAME
for Lua
Version
- This document describes lua-redis-parser v0.09rc4
- (<https://github.com/agentzh/lua-redis-parser/downloads>) released on 11
+ This document describes lua-redis-parser v0.09rc5
+ (<https://github.com/agentzh/lua-redis-parser/downloads>) released on 28
August 2011.
Description
@@ -77,6 +77,19 @@ Functions
-- the parse_reply method documented above
end
+ typename
+ syntax: *str = parser.typename(typ)*
+
+ Returns the textual representation of the reply type values returned by
+ the parse_reply and parse_replies functions. Here's the correspondence:
+
+ parser.typename(parser.BAD_REPLY) == "bad reply"
+ parser.typename(parser.INTEGER_REPLY) == "integer reply"
+ parser.typename(parser.ERROR_REPLY) == "error reply"
+ parser.typename(parser.STATUS_REPLY) == "status reply"
+ parser.typename(parser.BULK_REPLY) == "bulk reply"
+ parser.typename(parser.MULTI_BULK_REPLY) == "multi-bulk reply"
+
build_query
syntax: *raw_request = parser.build_query(args)*
@@ -110,6 +123,28 @@ Functions
Boolean values will be converted to 1 or 0, for "true" and "false",
respectively.
+Constants
+ BAD_REPLY
+ syntax: *typ = parser.BAD_REPLY*
+
+ INTEGER_REPLY
+ syntax: *typ = parser.INTEGER_REPLY*
+
+ ERROR_REPLY
+ syntax: *typ = parser.ERROR_REPLY*
+
+ STATUS_REPLY
+ syntax: *typ = parser.STATUS_REPLY*
+
+ BULK_REPLY
+ syntax: *typ = parser.BULK_REPLY*
+
+ MULTI_BULK_REPLY
+ syntax: *typ = parser.MULTI_BULK_REPLY*
+
+ null
+ syntax: *val = parser.null*
+
Background
This module is originally written for [[HttpLuaModule]] and
[[HttpRedis2Module]]:
@@ -201,5 +236,5 @@ SEE ALSO
* [[HttpRedis2Module]]
- * [Redis official site http://redis.io/]
+ * Redis official site (<http://redis.io/>)
View
@@ -6,7 +6,7 @@ lua-redis-parser - Redis reply parser and request constructor library for Lua
Version
=======
-This document describes lua-redis-parser [v0.09rc4](https://github.com/agentzh/lua-redis-parser/downloads) released on 11 August 2011.
+This document describes lua-redis-parser [v0.09rc5](https://github.com/agentzh/lua-redis-parser/downloads) released on 28 August 2011.
Description
===========
@@ -82,6 +82,21 @@ For instance,
end
+typename
+--------
+**syntax:** *str = parser.typename(typ)*
+
+Returns the textual representation of the reply type values returned by the [parse_reply](http://wiki.nginx.org/LuaRedisParser#parse_reply) and [parse_replies](http://wiki.nginx.org/LuaRedisParser#parse_replies) functions. Here's the correspondence:
+
+
+ parser.typename(parser.BAD_REPLY) == "bad reply"
+ parser.typename(parser.INTEGER_REPLY) == "integer reply"
+ parser.typename(parser.ERROR_REPLY) == "error reply"
+ parser.typename(parser.STATUS_REPLY) == "status reply"
+ parser.typename(parser.BULK_REPLY) == "bulk reply"
+ parser.typename(parser.MULTI_BULK_REPLY) == "multi-bulk reply"
+
+
build_query
-----------
**syntax:** *raw_request = parser.build_query(args)*
@@ -115,6 +130,37 @@ Null values should be specified by `parser.null` rather than Lua's `nil` value.
Boolean values will be converted to `1` or `0`, for `true` and `false`, respectively.
+Constants
+=========
+
+BAD_REPLY
+---------
+**syntax:** *typ = parser.BAD_REPLY*
+
+INTEGER_REPLY
+-------------
+**syntax:** *typ = parser.INTEGER_REPLY*
+
+ERROR_REPLY
+-----------
+**syntax:** *typ = parser.ERROR_REPLY*
+
+STATUS_REPLY
+------------
+**syntax:** *typ = parser.STATUS_REPLY*
+
+BULK_REPLY
+----------
+**syntax:** *typ = parser.BULK_REPLY*
+
+MULTI_BULK_REPLY
+----------------
+**syntax:** *typ = parser.MULTI_BULK_REPLY*
+
+null
+----
+**syntax:** *val = parser.null*
+
Background
==========
@@ -204,5 +250,5 @@ SEE ALSO
========
* [HttpLuaModule](http://wiki.nginx.org/HttpLuaModule)
* [HttpRedis2Module](http://wiki.nginx.org/HttpRedis2Module)
-* [Redis official site <http://redis.io/]>
+* [Redis official site](http://redis.io/)
View
@@ -4,7 +4,7 @@ lua-redis-parser - Redis reply parser and request constructor library for Lua
= Version =
-This document describes lua-redis-parser [https://github.com/agentzh/lua-redis-parser/downloads v0.09rc4] released on 11 August 2011.
+This document describes lua-redis-parser [https://github.com/agentzh/lua-redis-parser/downloads v0.09rc5] released on 28 August 2011.
= Description =
@@ -76,6 +76,20 @@ For instance,
end
</geshi>
+== typename ==
+'''syntax:''' ''str = parser.typename(typ)''
+
+Returns the textual representation of the reply type values returned by the [[#parse_reply|parse_reply]] and [[#parse_replies|parse_replies]] functions. Here's the correspondence:
+
+<geshi lang="lua">
+ parser.typename(parser.BAD_REPLY) == "bad reply"
+ parser.typename(parser.INTEGER_REPLY) == "integer reply"
+ parser.typename(parser.ERROR_REPLY) == "error reply"
+ parser.typename(parser.STATUS_REPLY) == "status reply"
+ parser.typename(parser.BULK_REPLY) == "bulk reply"
+ parser.typename(parser.MULTI_BULK_REPLY) == "multi-bulk reply"
+</geshi>
+
== build_query ==
'''syntax:''' ''raw_request = parser.build_query(args)''
@@ -108,6 +122,29 @@ Null values should be specified by <code>parser.null</code> rather than Lua's <c
Boolean values will be converted to <code>1</code> or <code>0</code>, for <code>true</code> and <code>false</code>, respectively.
+= Constants =
+
+== BAD_REPLY ==
+'''syntax:''' ''typ = parser.BAD_REPLY''
+
+== INTEGER_REPLY ==
+'''syntax:''' ''typ = parser.INTEGER_REPLY''
+
+== ERROR_REPLY ==
+'''syntax:''' ''typ = parser.ERROR_REPLY''
+
+== STATUS_REPLY ==
+'''syntax:''' ''typ = parser.STATUS_REPLY''
+
+== BULK_REPLY ==
+'''syntax:''' ''typ = parser.BULK_REPLY''
+
+== MULTI_BULK_REPLY ==
+'''syntax:''' ''typ = parser.MULTI_BULK_REPLY''
+
+== null ==
+'''syntax:''' ''val = parser.null''
+
= Background =
This module is originally written for [[HttpLuaModule]] and [[HttpRedis2Module]]:
@@ -187,5 +224,5 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
= SEE ALSO =
* [[HttpLuaModule]]
* [[HttpRedis2Module]]
-* [Redis official site http://redis.io/]
+* [http://redis.io/ Redis official site]

0 comments on commit 2f302a6

Please sign in to comment.