[Groonga-commit] groonga/groonga at 50dec2e [master] Define macros for pseudo column names

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Dec 16 14:06:00 JST 2013


Kouhei Sutou	2013-12-16 14:06:00 +0900 (Mon, 16 Dec 2013)

  New Revision: 50dec2e014efd1345fb95dc1514dc7daa0dabe56
  https://github.com/groonga/groonga/commit/50dec2e014efd1345fb95dc1514dc7daa0dabe56

  Message:
    Define macros for pseudo column names
    
    [groonga-dev,01999]
    
    Suggested by whombx. Thanks!!!

  Modified files:
    doc/source/reference/api/grn_column.txt
    include/groonga.h

  Modified: doc/source/reference/api/grn_column.txt (+91 -1)
===================================================================
--- doc/source/reference/api/grn_column.txt    2013-12-16 11:43:35 +0900 (bac1fa5)
+++ doc/source/reference/api/grn_column.txt    2013-12-16 14:06:00 +0900 (f139148)
@@ -1,6 +1,6 @@
 .. -*- rst -*-
 
-.. highlightlang:: none
+.. highlightlang:: c
 
 ``grn_column``
 ==============
@@ -18,6 +18,96 @@ TODO...
 Reference
 ---------
 
+.. c:macro:: GRN_COLUMN_NAME_ID
+
+   It returns the name of :doc:`/reference/pseudo_column` ``_id``.
+
+   It is useful to use with :c:macro:`GRN_COLUMN_NAME_ID_SIZE` like
+   the following:
+
+       grn_obj *id_column;
+       id_column = grn_ctx_get(ctx, GRN_COLUMN_NAME_ID, GRN_COLUMN_NAME_ID_SIZE);
+
+   Since 3.1.1.
+
+.. c:macro:: GRN_COLUMN_NAME_ID_SIZE
+
+   It returns the byte size of :c:macro:`GRN_COLUMN_NAME_ID`.
+
+   Since 3.1.1.
+
+.. c:macro:: GRN_COLUMN_NAME_KEY
+
+   It returns the name of :doc:`/reference/pseudo_column` ``_key``.
+
+   It is useful to use with :c:macro:`GRN_COLUMN_NAME_KEY_SIZE` like
+   the following:
+
+       grn_obj *key_column;
+       key_column = grn_ctx_get(ctx, GRN_COLUMN_NAME_KEY, GRN_COLUMN_NAME_KEY_SIZE);
+
+   Since 3.1.1.
+
+.. c:macro:: GRN_COLUMN_NAME_KEY_SIZE
+
+   It returns the byte size of :c:macro:`GRN_COLUMN_NAME_KEY`.
+
+   Since 3.1.1.
+
+.. c:macro:: GRN_COLUMN_NAME_VALUE
+
+   It returns the name of :doc:`/reference/pseudo_column` ``_value``.
+
+   It is useful to use with :c:macro:`GRN_COLUMN_NAME_VALUE_SIZE` like
+   the following:
+
+       grn_obj *value_column;
+       value_column = grn_ctx_get(ctx, GRN_COLUMN_NAME_VALUE, GRN_COLUMN_NAME_VALUE_SIZE);
+
+   Since 3.1.1.
+
+.. c:macro:: GRN_COLUMN_NAME_VALUE_SIZE
+
+   It returns the byte size of :c:macro:`GRN_COLUMN_NAME_VALUE`.
+
+   Since 3.1.1.
+
+.. c:macro:: GRN_COLUMN_NAME_SCORE
+
+   It returns the name of :doc:`/reference/pseudo_column` ``_score``.
+
+   It is useful to use with :c:macro:`GRN_COLUMN_NAME_SCORE_SIZE` like
+   the following:
+
+       grn_obj *score_column;
+       score_column = grn_ctx_get(ctx, GRN_COLUMN_NAME_SCORE, GRN_COLUMN_NAME_SCORE_SIZE);
+
+   Since 3.1.1.
+
+.. c:macro:: GRN_COLUMN_NAME_SCORE_SIZE
+
+   It returns the byte size of :c:macro:`GRN_COLUMN_NAME_SCORE`.
+
+   Since 3.1.1.
+
+.. c:macro:: GRN_COLUMN_NAME_NSUBRECS
+
+   It returns the name of :doc:`/reference/pseudo_column` ``_nsubrecs``.
+
+   It is useful to use with :c:macro:`GRN_COLUMN_NAME_NSUBRECS_SIZE` like
+   the following:
+
+       grn_obj *nsubrecs_column;
+       nsubrecs_column = grn_ctx_get(ctx, GRN_COLUMN_NAME_NSUBRECS, GRN_COLUMN_NAME_NSUBRECS_SIZE);
+
+   Since 3.1.1.
+
+.. c:macro:: GRN_COLUMN_NAME_NSUBRECS_SIZE
+
+   It returns the byte size of :c:macro:`GRN_COLUMN_NAME_NSUBRECS`.
+
+   Since 3.1.1.
+
 .. c:function:: grn_obj *grn_column_create(grn_ctx *ctx, grn_obj *table, const char *name, unsigned int name_size, const char *path, grn_obj_flags flags, grn_obj *type)
 
    tableに新たなカラムを定義します。nameは省略できません。一つのtableに同一のnameのcolumnを複数定義することはできません。

  Modified: include/groonga.h (+11 -0)
===================================================================
--- include/groonga.h    2013-12-16 11:43:35 +0900 (dcfbf6a)
+++ include/groonga.h    2013-12-16 14:06:00 +0900 (83f9840)
@@ -721,6 +721,17 @@ GRN_API unsigned int grn_table_size(grn_ctx *ctx, grn_obj *table);
  * API for column
  */
 
+#define GRN_COLUMN_NAME_ID            "_id"
+#define GRN_COLUMN_NAME_ID_SIZE       (sizeof(GRN_COLUMN_NAME_ID) - 1)
+#define GRN_COLUMN_NAME_KEY           "_key"
+#define GRN_COLUMN_NAME_KEY_SIZE      (sizeof(GRN_COLUMN_NAME_KEY) - 1)
+#define GRN_COLUMN_NAME_VALUE         "_value"
+#define GRN_COLUMN_NAME_VALUE_SIZE    (sizeof(GRN_COLUMN_NAME_VALUE) - 1)
+#define GRN_COLUMN_NAME_SCORE         "_score"
+#define GRN_COLUMN_NAME_SCORE_SIZE    (sizeof(GRN_COLUMN_NAME_SCORE) - 1)
+#define GRN_COLUMN_NAME_NSUBRECS      "_nsubrecs"
+#define GRN_COLUMN_NAME_NSUBRECS_SIZE (sizeof(GRN_COLUMN_NAME_NSUBRECS) - 1)
+
 GRN_API grn_obj *grn_column_create(grn_ctx *ctx, grn_obj *table,
                                    const char *name, unsigned int name_size,
                                    const char *path, grn_obj_flags flags, grn_obj *type);
-------------- next part --------------
HTML����������������������������...
下载 



More information about the Groonga-commit mailing list
Back to archive index