nostrdb: ndb_filter_from_json
Changelog-Added: Add method for parsing filter json Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
Daniel D’Aquino
parent
3fb4d81d48
commit
bbed448ccb
@@ -223,8 +223,13 @@ struct ndb_iterator {
|
||||
int index;
|
||||
};
|
||||
|
||||
union ndb_filter_element {
|
||||
struct ndb_filter_string {
|
||||
const char *string;
|
||||
int len;
|
||||
};
|
||||
|
||||
union ndb_filter_element {
|
||||
struct ndb_filter_string string;
|
||||
const unsigned char *id;
|
||||
uint64_t integer;
|
||||
};
|
||||
@@ -491,6 +496,9 @@ int ndb_filter_add_id_element(struct ndb_filter *, const unsigned char *id);
|
||||
int ndb_filter_add_int_element(struct ndb_filter *, uint64_t integer);
|
||||
int ndb_filter_add_str_element(struct ndb_filter *, const char *str);
|
||||
|
||||
// filters from json
|
||||
int ndb_filter_from_json(const char *, int len, struct ndb_filter *filter, unsigned char *buf, int bufsize);
|
||||
|
||||
// getting field elements
|
||||
unsigned char *ndb_filter_get_id_element(const struct ndb_filter *, const struct ndb_filter_elements *, int index);
|
||||
const char *ndb_filter_get_string_element(const struct ndb_filter *, const struct ndb_filter_elements *, int index);
|
||||
|
||||
Reference in New Issue
Block a user