Groonga
Loading...
Searching...
No Matches
column.h
Go to the documentation of this file.
1/*
2 Copyright(C) 2009-2017 Brazil
3 Copyright(C) 2018-2022 Sutou Kouhei <kou@clear-code.com>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19
20#pragma once
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26typedef struct _grn_column_cache grn_column_cache;
27
41#define GRN_COLUMN_NAME_ID "_id"
50#define GRN_COLUMN_NAME_ID_LEN (sizeof(GRN_COLUMN_NAME_ID) - 1)
63#define GRN_COLUMN_NAME_KEY "_key"
72#define GRN_COLUMN_NAME_KEY_LEN (sizeof(GRN_COLUMN_NAME_KEY) - 1)
84#define GRN_COLUMN_NAME_VALUE "_value"
93#define GRN_COLUMN_NAME_VALUE_LEN (sizeof(GRN_COLUMN_NAME_VALUE) - 1)
106#define GRN_COLUMN_NAME_SCORE "_score"
115#define GRN_COLUMN_NAME_SCORE_LEN (sizeof(GRN_COLUMN_NAME_SCORE) - 1)
130#define GRN_COLUMN_NAME_NSUBRECS "_nsubrecs"
139#define GRN_COLUMN_NAME_NSUBRECS_LEN (sizeof(GRN_COLUMN_NAME_NSUBRECS) - 1)
140#define GRN_COLUMN_NAME_MAX "_max"
141#define GRN_COLUMN_NAME_MAX_LEN (sizeof(GRN_COLUMN_NAME_MAX) - 1)
142#define GRN_COLUMN_NAME_MIN "_min"
143#define GRN_COLUMN_NAME_MIN_LEN (sizeof(GRN_COLUMN_NAME_MIN) - 1)
144#define GRN_COLUMN_NAME_SUM "_sum"
145#define GRN_COLUMN_NAME_SUM_LEN (sizeof(GRN_COLUMN_NAME_SUM) - 1)
146/* Deprecated since 10.0.4. Use GRN_COLUMN_NAME_MEAN instead. */
147#define GRN_COLUMN_NAME_AVG "_avg"
148#define GRN_COLUMN_NAME_AVG_LEN (sizeof(GRN_COLUMN_NAME_AVG) - 1)
149#define GRN_COLUMN_NAME_MEAN "_mean"
150#define GRN_COLUMN_NAME_MEAN_LEN (sizeof(GRN_COLUMN_NAME_MEAN) - 1)
151
186 grn_obj *table,
187 const char *name,
188 unsigned int name_size,
189 const char *path,
190 grn_column_flags flags,
191 grn_obj *type);
194 grn_obj *table,
195 const char *name,
196 uint32_t name_size,
197 const char *path,
198 grn_obj *base_column);
199
200#define GRN_COLUMN_OPEN_OR_CREATE(ctx, \
201 table, \
202 name, \
203 name_size, \
204 path, \
205 flags, \
206 type, \
207 column) \
208 (((column) = grn_obj_column((ctx), (table), (name), (name_size))) || \
209 ((column) = grn_column_create((ctx), \
210 (table), \
211 (name), \
212 (name_size), \
213 (path), \
214 (flags), \
215 (type))))
216
239 grn_obj *column,
240 grn_id id,
241 unsigned int section,
242 grn_obj *oldvalue,
243 grn_obj *newvalue);
278
285
288GRN_API void
290GRN_API void *
292 grn_column_cache *cache,
293 grn_id id,
294 size_t *value_size);
295
298
299#ifdef __cplusplus
300}
301#endif
GRN_API grn_obj * grn_column_create(grn_ctx *ctx, grn_obj *table, const char *name, unsigned int name_size, const char *path, grn_column_flags flags, grn_obj *type)
Create a new column in a table.
GRN_API grn_column_flags grn_column_get_missing_mode(grn_ctx *ctx, grn_obj *column)
GRN_API grn_column_flags grn_column_get_invalid_mode(grn_ctx *ctx, grn_obj *column)
GRN_API void * grn_column_cache_ref(grn_ctx *ctx, grn_column_cache *cache, grn_id id, size_t *value_size)
GRN_API grn_obj * grn_column_create_similar(grn_ctx *ctx, grn_obj *table, const char *name, uint32_t name_size, const char *path, grn_obj *base_column)
GRN_API grn_column_cache * grn_column_cache_open(grn_ctx *ctx, grn_obj *column)
GRN_API grn_rc grn_column_index_update(grn_ctx *ctx, grn_obj *column, grn_id id, unsigned int section, grn_obj *oldvalue, grn_obj *newvalue)
Update an entry in an index column based on the old and new values.
GRN_API grn_rc grn_column_copy(grn_ctx *ctx, grn_obj *from, grn_obj *to)
struct _grn_column_cache grn_column_cache
Definition column.h:26
GRN_API grn_rc grn_column_truncate(grn_ctx *ctx, grn_obj *column)
Delete all values in the specified column.
GRN_API grn_column_flags grn_column_get_flags(grn_ctx *ctx, grn_obj *column)
GRN_API grn_obj * grn_column_table(grn_ctx *ctx, grn_obj *column)
Retrieve a table to which a given column belongs.
GRN_API void grn_column_cache_close(grn_ctx *ctx, grn_column_cache *cache)
grn_rc
Definition groonga.h:61
uint32_t grn_id
Definition groonga.h:44
#define GRN_API
Definition groonga.h:39
uint32_t grn_column_flags
Definition groonga.h:681
Definition groonga.h:351
Definition groonga.h:919