Skip to content

Commit

Permalink
docs: api/grn_table: Move the grn_table_add() reference to the header…
Browse files Browse the repository at this point in the history
… file (groonga#1838)

GitHub: groongaGH-1817

Prepare to switch to documents automatically generated by Doxygen.
  • Loading branch information
abetomo authored Jul 31, 2024
1 parent 1fea7c6 commit 891ae39
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
10 changes: 0 additions & 10 deletions doc/source/reference/api/grn_table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ TODO...
Reference
---------

.. c:function:: grn_id grn_table_add(grn_ctx *ctx, grn_obj *table, const void *key, unsigned int key_size, int *added)
keyに対応する新しいrecordをtableに追加し、そのIDを返します。keyに対応するrecordがすでにtableに存在するならば、そのrecordのIDを返します。
``GRN_OBJ_TABLE_NO_KEY`` が指定されたtableでは、key, key_size は無視されます。
:param table: 対象tableを指定します。
:param key: 検索keyを指定します。
:param added: NULL以外の値が指定された場合、新たにrecordが追加された時には1が、既存recordだった時には0がセットされます。
.. c:function:: grn_id grn_table_get(grn_ctx *ctx, grn_obj *table, const void *key, unsigned int key_size)
It finds a record that has key parameter and returns ID of the found record. If table parameter is a database, it finds an object (table, column and so on) that has key parameter and returns ID of the found object.
Expand Down
18 changes: 16 additions & 2 deletions include/groonga/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,22 @@ grn_table_create_similar(grn_ctx *ctx,
(flags), \
(key_type), \
(value_type))))

/* TODO: int *added -> bool *added */
/**
* \brief Add a new record with `key` to the table and return its ID.
* If `key` already exists in the table, returns the ID of the record.
* For tables with GRN_OBJ_TABLE_NO_KEY, `key` and `key_size` are ignored
*
* \param ctx The context object
* \param table Target table
* \param key Search key
* \param key_size Length of `key`
* \param added If a non `NULL` value is specified, 1 is set when a new record
* is added, and 0 is set when it is an existing record
*
* \return Record ID on success, GRN_ID_NIL on error
*
* \todo int *added -> bool *added
*/
GRN_API grn_id
grn_table_add(grn_ctx *ctx,
grn_obj *table,
Expand Down

0 comments on commit 891ae39

Please sign in to comment.