JULEA
jbson.h
Go to the documentation of this file.
1 /*
2  * JULEA - Flexible storage framework
3  * Copyright (C) 2019 Benjamin Warnke
4  * Copyright (C) 2022 Timm Leon Erxleben
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
24 #ifndef JULEA_DB_UTIL_BSON_H
25 #define JULEA_DB_UTIL_BSON_H
26 
27 #include <glib.h>
28 
29 #include <bson.h>
30 
31 #include <julea-db.h>
32 
33 gboolean j_bson_init(bson_t* bson, GError** error);
34 void j_bson_destroy(bson_t* bson);
35 
36 gboolean j_bson_has_field(bson_t* bson, gchar const* name, gboolean* has_field, GError** error);
37 gboolean j_bson_has_enough_keys(const bson_t* bson, guint32 min_keys, GError** error);
38 gboolean j_bson_count_keys(bson_t* bson, guint32* count, GError** error);
39 gboolean j_bson_array_generate_key(guint32 index, const char** key, char* buf, guint buf_length, GError** error);
40 gboolean j_bson_append_array(bson_t* bson, const char* key, bson_t* bson_child, GError** error);
41 gboolean j_bson_append_array_begin(bson_t* bson, const char* key, bson_t* bson_child, GError** error);
42 gboolean j_bson_append_array_end(bson_t* bson, bson_t* bson_child, GError** error);
43 gboolean j_bson_append_document(bson_t* bson, const char* key, bson_t* bson_child, GError** error);
44 gboolean j_bson_append_document_begin(bson_t* bson, const char* key, bson_t* bson_child, GError** error);
45 gboolean j_bson_append_document_end(bson_t* bson, bson_t* bson_child, GError** error);
46 gboolean j_bson_append_value(bson_t* bson, const char* name, JDBType type, JDBTypeValue* value, GError** error);
47 
48 gboolean j_bson_iter_init(bson_iter_t* iter, const bson_t* bson, GError** error);
49 gboolean j_bson_iter_next(bson_iter_t* iter, gboolean* has_next, GError** error);
50 gboolean j_bson_iter_key_equals(bson_iter_t* iter, const char* key, gboolean* equals, GError** error);
51 gboolean j_bson_iter_skip_key(bson_iter_t* iter, const char* key, GError** error);
52 const char* j_bson_iter_key(bson_iter_t* iter, GError** error);
53 gboolean j_bson_iter_value(bson_iter_t* iter, JDBType type, JDBTypeValue* value, GError** error);
54 gboolean j_bson_iter_find(bson_iter_t* iter, const char* key, GError** error);
55 gboolean j_bson_iter_not_find(bson_iter_t* iter, const char* key, GError** error);
56 gboolean j_bson_iter_recurse_array(bson_iter_t* iter, bson_iter_t* iter_child, GError** error);
57 gboolean j_bson_iter_recurse_document(bson_iter_t* iter, bson_iter_t* iter_child, GError** error);
58 gboolean j_bson_iter_copy_document(bson_iter_t* iter, bson_t* bson, GError** error);
59 
60 // enables the use of g_autoptr(bson_t)
61 G_DEFINE_AUTOPTR_CLEANUP_FUNC(bson_t, j_bson_destroy)
62 
63 #endif
gboolean j_bson_iter_recurse_document(bson_iter_t *iter, bson_iter_t *iter_child, GError **error)
Definition: jbson.c:498
gboolean j_bson_append_value(bson_t *bson, const char *name, JDBType type, JDBTypeValue *value, GError **error)
Definition: jbson.c:159
gboolean j_bson_iter_init(bson_iter_t *iter, const bson_t *bson, GError **error)
Definition: jbson.c:36
gboolean j_bson_append_array_begin(bson_t *bson, const char *key, bson_t *bson_child, GError **error)
Definition: jbson.c:717
gboolean j_bson_iter_skip_key(bson_iter_t *iter, const char *key, GError **error)
Definition: jbson.c:115
gboolean j_bson_iter_recurse_array(bson_iter_t *iter, bson_iter_t *iter_child, GError **error)
Definition: jbson.c:469
gboolean j_bson_append_document(bson_t *bson, const char *key, bson_t *bson_child, GError **error)
Definition: jbson.c:769
gboolean j_bson_iter_next(bson_iter_t *iter, gboolean *has_next, GError **error)
Definition: jbson.c:65
gboolean j_bson_array_generate_key(guint32 index, const char **key, char *buf, guint buf_length, GError **error)
Definition: jbson.c:663
gboolean j_bson_iter_key_equals(bson_iter_t *iter, const char *key, gboolean *equals, GError **error)
Definition: jbson.c:90
const char * j_bson_iter_key(bson_iter_t *iter, GError **error)
Definition: jbson.c:142
gboolean j_bson_iter_find(bson_iter_t *iter, const char *key, GError **error)
Definition: jbson.c:411
gboolean j_bson_append_array_end(bson_t *bson, bson_t *bson_child, GError **error)
Definition: jbson.c:746
gboolean j_bson_iter_copy_document(bson_iter_t *iter, bson_t *bson, GError **error)
Definition: jbson.c:527
gboolean j_bson_has_field(bson_t *bson, gchar const *name, gboolean *has_field, GError **error)
Definition: jbson.c:612
gboolean j_bson_append_document_end(bson_t *bson, bson_t *bson_child, GError **error)
Definition: jbson.c:827
gboolean j_bson_append_document_begin(bson_t *bson, const char *key, bson_t *bson_child, GError **error)
Definition: jbson.c:798
gboolean j_bson_append_array(bson_t *bson, const char *key, bson_t *bson_child, GError **error)
Definition: jbson.c:688
gboolean j_bson_init(bson_t *bson, GError **error)
Definition: jbson.c:593
void j_bson_destroy(bson_t *bson)
Definition: jbson.c:582
gboolean j_bson_count_keys(bson_t *bson, guint32 *count, GError **error)
Definition: jbson.c:637
gboolean j_bson_iter_value(bson_iter_t *iter, JDBType type, JDBTypeValue *value, GError **error)
Definition: jbson.c:271
gboolean j_bson_iter_not_find(bson_iter_t *iter, const char *key, GError **error)
Definition: jbson.c:440
gboolean j_bson_has_enough_keys(const bson_t *bson, guint32 min_keys, GError **error)
Definition: jbson.c:559
JDBType
Definition: jdb-type.h:35
Definition: jdb-type.h:50