nostrdb: expose filter introspection methods
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
Daniel D’Aquino
parent
a86d8416fc
commit
b326f007f2
@@ -637,20 +637,20 @@ ndb_filter_elements_data(const struct ndb_filter *filter, int offset)
|
||||
return data;
|
||||
}
|
||||
|
||||
static inline unsigned char *
|
||||
ndb_filter_get_id_element(const struct ndb_filter *filter, struct ndb_filter_elements *els, int index)
|
||||
unsigned char *
|
||||
ndb_filter_get_id_element(const struct ndb_filter *filter, const struct ndb_filter_elements *els, int index)
|
||||
{
|
||||
return ndb_filter_elements_data(filter, els->elements[index]);
|
||||
}
|
||||
|
||||
static inline const char *
|
||||
ndb_filter_get_string_element(const struct ndb_filter *filter, struct ndb_filter_elements *els, int index)
|
||||
const char *
|
||||
ndb_filter_get_string_element(const struct ndb_filter *filter, const struct ndb_filter_elements *els, int index)
|
||||
{
|
||||
return (const char *)ndb_filter_elements_data(filter, els->elements[index]);
|
||||
}
|
||||
|
||||
static inline uint64_t
|
||||
ndb_filter_get_int_element(struct ndb_filter_elements *els, int index)
|
||||
uint64_t
|
||||
ndb_filter_get_int_element(const struct ndb_filter_elements *els, int index)
|
||||
{
|
||||
return els->elements[index];
|
||||
}
|
||||
|
||||
@@ -491,6 +491,11 @@ 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);
|
||||
|
||||
// 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);
|
||||
uint64_t ndb_filter_get_int_element(const struct ndb_filter_elements *, int index);
|
||||
|
||||
struct ndb_filter_elements *ndb_filter_current_element(const struct ndb_filter *);
|
||||
struct ndb_filter_elements *ndb_filter_get_elements(const struct ndb_filter *, int);
|
||||
int ndb_filter_start_field(struct ndb_filter *, enum ndb_filter_fieldtype);
|
||||
|
||||
Reference in New Issue
Block a user