nostrdb: expose ndb_filter_get_elements

This can be used to iterate though filter elements

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-08-13 11:20:38 -07:00
committed by Daniel D’Aquino
parent b5c57dc935
commit a86d8416fc
2 changed files with 2 additions and 1 deletions

View File

@@ -610,7 +610,7 @@ ndb_filter_current_element(const struct ndb_filter *filter)
return ndb_filter_get_elements_by_offset(filter, filter->current); return ndb_filter_get_elements_by_offset(filter, filter->current);
} }
static inline struct ndb_filter_elements * struct ndb_filter_elements *
ndb_filter_get_elements(const struct ndb_filter *filter, int index) ndb_filter_get_elements(const struct ndb_filter *filter, int index)
{ {
if (filter->num_elements <= 0) if (filter->num_elements <= 0)

View File

@@ -492,6 +492,7 @@ int ndb_filter_add_int_element(struct ndb_filter *, uint64_t integer);
int ndb_filter_add_str_element(struct ndb_filter *, const char *str); int ndb_filter_add_str_element(struct ndb_filter *, const char *str);
struct ndb_filter_elements *ndb_filter_current_element(const struct ndb_filter *); 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); int ndb_filter_start_field(struct ndb_filter *, enum ndb_filter_fieldtype);
int ndb_filter_start_tag_field(struct ndb_filter *, char tag); int ndb_filter_start_tag_field(struct ndb_filter *, char tag);
int ndb_filter_matches(struct ndb_filter *, struct ndb_note *); int ndb_filter_matches(struct ndb_filter *, struct ndb_note *);