Groonga
Loading...
Searching...
No Matches
pat.h File Reference
#include "hash.h"
Include dependency graph for pat.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GRN_PAT_EACH(ctx, pat, id, key, key_size, value, block)
#define GRN_PAT_EACH_BEGIN(ctx, pat, cursor, id)
#define GRN_PAT_EACH_END(ctx, cursor)

Typedefs

typedef struct _grn_pat grn_pat
typedef struct _grn_pat_cursor grn_pat_cursor
typedef struct _grn_table_scan_hit grn_pat_scan_hit

Functions

GRN_API grn_pat * grn_pat_create (grn_ctx *ctx, const char *path, unsigned int key_size, unsigned int value_size, unsigned int flags)
GRN_API grn_pat * grn_pat_open (grn_ctx *ctx, const char *path)
GRN_API grn_rc grn_pat_close (grn_ctx *ctx, grn_pat *pat)
GRN_API grn_rc grn_pat_remove (grn_ctx *ctx, const char *path)
GRN_API grn_id grn_pat_get (grn_ctx *ctx, grn_pat *pat, const void *key, unsigned int key_size, void **value)
GRN_API grn_id grn_pat_add (grn_ctx *ctx, grn_pat *pat, const void *key, unsigned int key_size, void **value, int *added)
GRN_API int grn_pat_get_key (grn_ctx *ctx, grn_pat *pat, grn_id id, void *keybuf, int bufsize)
GRN_API int grn_pat_get_key2 (grn_ctx *ctx, grn_pat *pat, grn_id id, grn_obj *bulk)
GRN_API int grn_pat_get_value (grn_ctx *ctx, grn_pat *pat, grn_id id, void *valuebuf)
GRN_API grn_rc grn_pat_set_value (grn_ctx *ctx, grn_pat *pat, grn_id id, const void *value, int flags)
GRN_API grn_rc grn_pat_delete_by_id (grn_ctx *ctx, grn_pat *pat, grn_id id, grn_table_delete_optarg *optarg)
GRN_API grn_rc grn_pat_delete (grn_ctx *ctx, grn_pat *pat, const void *key, unsigned int key_size, grn_table_delete_optarg *optarg)
GRN_API int grn_pat_delete_with_sis (grn_ctx *ctx, grn_pat *pat, grn_id id, grn_table_delete_optarg *optarg)
GRN_API int grn_pat_scan (grn_ctx *ctx, grn_pat *pat, const char *str, unsigned int str_len, grn_pat_scan_hit *sh, unsigned int sh_size, const char **rest)
GRN_API grn_rc grn_pat_prefix_search (grn_ctx *ctx, grn_pat *pat, const void *key, unsigned int key_size, grn_hash *h)
GRN_API grn_rc grn_pat_suffix_search (grn_ctx *ctx, grn_pat *pat, const void *key, unsigned int key_size, grn_hash *h)
GRN_API grn_id grn_pat_lcp_search (grn_ctx *ctx, grn_pat *pat, const void *key, unsigned int key_size)
GRN_API unsigned int grn_pat_size (grn_ctx *ctx, grn_pat *pat)
GRN_API grn_pat_cursor * grn_pat_cursor_open (grn_ctx *ctx, grn_pat *pat, const void *min, unsigned int min_size, const void *max, unsigned int max_size, int offset, int limit, int flags)
GRN_API grn_id grn_pat_cursor_next (grn_ctx *ctx, grn_pat_cursor *c)
GRN_API void grn_pat_cursor_close (grn_ctx *ctx, grn_pat_cursor *c)
GRN_API int grn_pat_cursor_get_key (grn_ctx *ctx, grn_pat_cursor *c, void **key)
GRN_API int grn_pat_cursor_get_value (grn_ctx *ctx, grn_pat_cursor *c, void **value)
GRN_API int grn_pat_cursor_get_key_value (grn_ctx *ctx, grn_pat_cursor *c, void **key, unsigned int *key_size, void **value)
GRN_API grn_rc grn_pat_cursor_set_value (grn_ctx *ctx, grn_pat_cursor *c, const void *value, int flags)
GRN_API grn_rc grn_pat_cursor_delete (grn_ctx *ctx, grn_pat_cursor *c, grn_table_delete_optarg *optarg)

Macro Definition Documentation

◆ GRN_PAT_EACH

#define GRN_PAT_EACH ( ctx,
pat,
id,
key,
key_size,
value,
block )
Value:
do { \
grn_pat_cursor *_sc = NULL; \
if (pat && grn_pat_size(ctx, pat) > 0) { \
_sc = grn_pat_cursor_open(ctx, pat, NULL, 0, NULL, 0, 0, -1, 0); \
} \
if (_sc) { \
grn_id id; \
while ((id = grn_pat_cursor_next(ctx, _sc))) { \
grn_pat_cursor_get_key_value(ctx, \
_sc, \
(void **)(key), \
(key_size), \
(void **)(value)); \
block \
} \
grn_pat_cursor_close(ctx, _sc); \
} \
} while (0)
uint32_t grn_id
Definition groonga.h:44
GRN_API unsigned int grn_pat_size(grn_ctx *ctx, grn_pat *pat)
GRN_API grn_id grn_pat_cursor_next(grn_ctx *ctx, grn_pat_cursor *c)
struct _grn_pat_cursor grn_pat_cursor
Definition pat.h:29
GRN_API grn_pat_cursor * grn_pat_cursor_open(grn_ctx *ctx, grn_pat *pat, const void *min, unsigned int min_size, const void *max, unsigned int max_size, int offset, int limit, int flags)

◆ GRN_PAT_EACH_BEGIN

#define GRN_PAT_EACH_BEGIN ( ctx,
pat,
cursor,
id )
Value:
do { \
if ((pat) && grn_pat_size((ctx), (pat)) > 0) { \
grn_pat_cursor *cursor = \
grn_pat_cursor_open((ctx), (pat), NULL, 0, NULL, 0, 0, -1, 0); \
if (cursor) { \
grn_id id; \
while ((id = grn_pat_cursor_next((ctx), (cursor))) != GRN_ID_NIL) {
#define GRN_ID_NIL
Means "does not exist".
Definition groonga.h:55

◆ GRN_PAT_EACH_END

#define GRN_PAT_EACH_END ( ctx,
cursor )
Value:
} \
grn_pat_cursor_close((ctx), (cursor)); \
} \
} \
} \
while (false)

Typedef Documentation

◆ grn_pat

typedef struct _grn_pat grn_pat

◆ grn_pat_cursor

typedef struct _grn_pat_cursor grn_pat_cursor

◆ grn_pat_scan_hit

Function Documentation

◆ grn_pat_add()

GRN_API grn_id grn_pat_add ( grn_ctx * ctx,
grn_pat * pat,
const void * key,
unsigned int key_size,
void ** value,
int * added )

◆ grn_pat_close()

GRN_API grn_rc grn_pat_close ( grn_ctx * ctx,
grn_pat * pat )

◆ grn_pat_create()

GRN_API grn_pat * grn_pat_create ( grn_ctx * ctx,
const char * path,
unsigned int key_size,
unsigned int value_size,
unsigned int flags )

◆ grn_pat_cursor_close()

GRN_API void grn_pat_cursor_close ( grn_ctx * ctx,
grn_pat_cursor * c )

◆ grn_pat_cursor_delete()

GRN_API grn_rc grn_pat_cursor_delete ( grn_ctx * ctx,
grn_pat_cursor * c,
grn_table_delete_optarg * optarg )

◆ grn_pat_cursor_get_key()

GRN_API int grn_pat_cursor_get_key ( grn_ctx * ctx,
grn_pat_cursor * c,
void ** key )

◆ grn_pat_cursor_get_key_value()

GRN_API int grn_pat_cursor_get_key_value ( grn_ctx * ctx,
grn_pat_cursor * c,
void ** key,
unsigned int * key_size,
void ** value )

◆ grn_pat_cursor_get_value()

GRN_API int grn_pat_cursor_get_value ( grn_ctx * ctx,
grn_pat_cursor * c,
void ** value )

◆ grn_pat_cursor_next()

GRN_API grn_id grn_pat_cursor_next ( grn_ctx * ctx,
grn_pat_cursor * c )

◆ grn_pat_cursor_open()

GRN_API grn_pat_cursor * grn_pat_cursor_open ( grn_ctx * ctx,
grn_pat * pat,
const void * min,
unsigned int min_size,
const void * max,
unsigned int max_size,
int offset,
int limit,
int flags )

◆ grn_pat_cursor_set_value()

GRN_API grn_rc grn_pat_cursor_set_value ( grn_ctx * ctx,
grn_pat_cursor * c,
const void * value,
int flags )

◆ grn_pat_delete()

GRN_API grn_rc grn_pat_delete ( grn_ctx * ctx,
grn_pat * pat,
const void * key,
unsigned int key_size,
grn_table_delete_optarg * optarg )

◆ grn_pat_delete_by_id()

GRN_API grn_rc grn_pat_delete_by_id ( grn_ctx * ctx,
grn_pat * pat,
grn_id id,
grn_table_delete_optarg * optarg )

◆ grn_pat_delete_with_sis()

GRN_API int grn_pat_delete_with_sis ( grn_ctx * ctx,
grn_pat * pat,
grn_id id,
grn_table_delete_optarg * optarg )

◆ grn_pat_get()

GRN_API grn_id grn_pat_get ( grn_ctx * ctx,
grn_pat * pat,
const void * key,
unsigned int key_size,
void ** value )

◆ grn_pat_get_key()

GRN_API int grn_pat_get_key ( grn_ctx * ctx,
grn_pat * pat,
grn_id id,
void * keybuf,
int bufsize )

◆ grn_pat_get_key2()

GRN_API int grn_pat_get_key2 ( grn_ctx * ctx,
grn_pat * pat,
grn_id id,
grn_obj * bulk )

◆ grn_pat_get_value()

GRN_API int grn_pat_get_value ( grn_ctx * ctx,
grn_pat * pat,
grn_id id,
void * valuebuf )

◆ grn_pat_lcp_search()

GRN_API grn_id grn_pat_lcp_search ( grn_ctx * ctx,
grn_pat * pat,
const void * key,
unsigned int key_size )

◆ grn_pat_open()

GRN_API grn_pat * grn_pat_open ( grn_ctx * ctx,
const char * path )

◆ grn_pat_prefix_search()

GRN_API grn_rc grn_pat_prefix_search ( grn_ctx * ctx,
grn_pat * pat,
const void * key,
unsigned int key_size,
grn_hash * h )

◆ grn_pat_remove()

GRN_API grn_rc grn_pat_remove ( grn_ctx * ctx,
const char * path )

◆ grn_pat_scan()

GRN_API int grn_pat_scan ( grn_ctx * ctx,
grn_pat * pat,
const char * str,
unsigned int str_len,
grn_pat_scan_hit * sh,
unsigned int sh_size,
const char ** rest )

◆ grn_pat_set_value()

GRN_API grn_rc grn_pat_set_value ( grn_ctx * ctx,
grn_pat * pat,
grn_id id,
const void * value,
int flags )

◆ grn_pat_size()

GRN_API unsigned int grn_pat_size ( grn_ctx * ctx,
grn_pat * pat )

◆ grn_pat_suffix_search()

GRN_API grn_rc grn_pat_suffix_search ( grn_ctx * ctx,
grn_pat * pat,
const void * key,
unsigned int key_size,
grn_hash * h )