[RFC] ngx_rds_json: "errstr_key" branch: new directives rds_json_errcode_key and rds_json_errstr_key

11 views
Skip to first unread message

agentzh

unread,
May 23, 2012, 10:24:13 PM5/23/12
to openresty, 万珣新
Hello!

Liseen Wan has been working on the "errstr_key" branch in
ngx_rds_json's git repository, which added new configure directives
rds_json_errcode_key and rds_json_errstr_key:

https://github.com/agentzh/rds-json-nginx-module/commits/errstr_key

Here is a small example demonstrating its basic usage:

location /mysql {
drizzle_pass backend;
drizzle_query "update cats set name='bob' where name='bob'";
rds_json on;
rds_json_errcode_key "code";
rds_json_errstr_key "str";

set $name 'Jimmy';
set $age 32;
rds_json_user_property name $name;
rds_json_user_property age $age;
}

Then accessing /mysql may yield something like this:

{"name":"Jimmy","age":"32","code":0,"str":"Rows matched: 1
Changed: 0 Warnings: 0"}

That is, the default key names "errcode" and "errstr" can be
configured to custom keys like "code" and "str", respectively.

Comments will be highly appreciated on the changes on this branch :)

Thanks!
-agentzh
Reply all
Reply to author
Forward
0 new messages