[Groonga-commit] groonga/groonga [master] [doc] start writing a document about output format.

Back to archive index

null+****@clear***** null+****@clear*****
2012年 1月 28日 (土) 15:49:40 JST


Kouhei Sutou	2012-01-28 15:49:40 +0900 (Sat, 28 Jan 2012)

  New Revision: 98b91b47e566514caac635b5856b2c340d0d684e

  Log:
    [doc] start writing a document about output format.

  Added files:
    doc/source/output.txt
  Modified files:
    doc/source/reference.txt

  Added: doc/source/output.txt (+100 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/output.txt    2012-01-28 15:49:40 +0900 (fad98a6)
@@ -0,0 +1,100 @@
+.. -*- rst -*-
+
+.. highlightlang:: none
+
+Output
+======
+
+Groonga supports the following output format types:
+
+  * `JSON <http://www.json.org/>`_
+  * `XML <http://www.w3.org/XML/>`_
+  * TSV (Tab Separated Values)
+  * `MessagePack <http://msgpack.org/>`_
+
+JSON is the default output format.
+
+Usage
+-----
+
+Groonga has the following query interfaces:
+
+  * command line
+  * HTTP
+
+They provides different ways to change output format type.
+
+Command line
+^^^^^^^^^^^^
+
+You can use command line query interface by ``groonga
+DB_PATH`` or ``groonga -c``. Those groonga commands shows
+``> `` prompt. In this query interface, you can specify
+output format type by ``output_type`` option.
+
+If you don't specify ``output_type`` option, you will get
+a result in JSON format::
+
+  > status
+  [[0,1327721628.10738,0.000131845474243164],{"alloc_count":142,"starttime":1327721626,"uptime":2,"version":"1.2.9-92-gb87d9f8","n_queries":0,"cache_hit_rate":0.0,"command_version":1,"default_command_version":1,"max_command_version":2}]
+
+You can specify ``json`` as ``output_type`` value to get a
+result in JSON format explicitly::
+
+  > status --output_type json
+  [[0,1327721639.08321,7.93933868408203e-05],{"alloc_count":144,"starttime":1327721626,"uptime":13,"version":"1.2.9-92-gb87d9f8","n_queries":0,"cache_hit_rate":0.0,"command_version":1,"default_command_version":1,"max_command_version":2}]
+
+You need to specify ``xml`` as ``output_type`` value to
+get a result in XML format::
+
+  > status --output_type xml
+  <?xml version="1.0" encoding="utf-8"?>
+  <RESULT CODE="0" UP="1327721649.61095" ELAPSED="0.000126361846923828">
+  <RESULT>
+  <TEXT>alloc_count</TEXT>
+  <INT>146</INT>
+  <TEXT>starttime</TEXT>
+  <INT>1327721626</INT>
+  <TEXT>uptime</TEXT>
+  <INT>23</INT>
+  <TEXT>version</TEXT>
+  <TEXT>1.2.9-92-gb87d9f8</TEXT>
+  <TEXT>n_queries</TEXT>
+  <INT>0</INT>
+  <TEXT>cache_hit_rate</TEXT>
+  <FLOAT>0.0</FLOAT>
+  <TEXT>command_version</TEXT>
+  <INT>1</INT>
+  <TEXT>default_command_version</TEXT>
+  <INT>1</INT>
+  <TEXT>max_command_version</TEXT>
+  <INT>2</INT></RESULT>
+  </RESULT>
+
+You need to specify ``tsv`` as ``output_type`` value to
+get a result in TSV format::
+
+  > status --output_type tsv
+  0	1327721664.82675	0.000113964080810547
+  "alloc_count"	146
+  "starttime"	1327721626
+  "uptime"	38
+  "version"	"1.2.9-92-gb87d9f8"
+  "n_queries"	0
+  "cache_hit_rate"	0.0
+  "command_version"	1
+  "default_command_version"	1
+  "max_command_version"	2
+  END
+
+
+You need to specify ``msgpack`` as ``output_type`` value to
+get a result in MessagePack format::
+
+  > status --output_type msgpack # MessagePack
+  (... omitted because MessagePack is binary data format. ...)
+
+HTTP
+^^^^
+
+...

  Modified: doc/source/reference.txt (+1 -0)
===================================================================
--- doc/source/reference.txt    2012-01-28 12:33:33 +0900 (b36f3ea)
+++ doc/source/reference.txt    2012-01-28 15:49:40 +0900 (40fdbc6)
@@ -9,6 +9,7 @@
    :maxdepth: 2
 
    executables
+   output
    commands
    type
    pseudo_column




Groonga-commit メーリングリストの案内
Back to archive index