summaryrefslogtreecommitdiff
path: root/storage/mroonga/vendor/groonga/lib/ts/ts_util.h
blob: 24a6a50731c637b2f227d479a2cf5501e41074c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* -*- c-basic-offset: 2 -*- */
/*
  Copyright(C) 2015-2016 Brazil

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License version 2.1 as published by the Free Software Foundation.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1335  USA
*/

#pragma once

#include "../grn.h"

#include "ts_buf.h"
#include "ts_types.h"

#ifdef __cplusplus
extern "C" {
#endif

/* grn_ts_obj_increment_ref_count() increments an object reference count. */
grn_rc grn_ts_obj_increment_ref_count(grn_ctx *ctx, grn_obj *obj);

/* grn_ts_obj_is_table() returns whether or not an object is a table. */
grn_ts_bool grn_ts_obj_is_table(grn_ctx *ctx, grn_obj *obj);

/* grn_ts_obj_is_column() returns whether or not an object is a column. */
grn_ts_bool grn_ts_obj_is_column(grn_ctx *ctx, grn_obj *obj);

/*
 * grn_ts_ja_get_value() gets a value from ja and writes it to buf. Note that
 * the value is appended to the end of buf.
 */
grn_rc grn_ts_ja_get_value(grn_ctx *ctx, grn_obj *ja, grn_ts_id id,
                           grn_ts_buf *buf, size_t *value_size);

/* grn_ts_table_has_key() returns whether or not a table has _key. */
grn_ts_bool grn_ts_table_has_key(grn_ctx *ctx, grn_obj *table);

/* grn_ts_table_has_value() returns whether or not a table has _value. */
grn_ts_bool grn_ts_table_has_value(grn_ctx *ctx, grn_obj *table);

/*
 * grn_ts_table_get_value() gets a reference to a value (_value). On failure,
 * this function returns NULL.
 */
const void *grn_ts_table_get_value(grn_ctx *ctx, grn_obj *table, grn_ts_id id);

#ifdef __cplusplus
}
#endif