GENDERS_TESTQUERY(3)
π GENDERS_TESTQUERY π
ok so this is a page from libgenders(3) and it's literally all about one lil function that answers the question: does this node match this query or not π¦
β¨ NAME β¨
genders_testquery β ask the genders database if a node matches a query, bestie
πΈ SYNOPSIS πΈ
#include <genders.h>
int genders_testquery(genders_t handle, const char *node, const char *query);
π DESCRIPTION π
ok so genders_testquery() checks if the node that node points to matches all the conditions you put in query. and if node is NULL? no worries, it just tests the current node instead π«Ά
the queries are built out of set operations on genders attributes and values β union, intersection, difference, and complement. you pass the whole thing as a string through the query parameter. here's the tea on the operators:
- union β two pipe symbols:
'||' - intersection β two ampersand symbols:
'&&' - difference β two minus symbols:
'--' - complement β a tilde:
'~'
set operations get performed left to right, periodt. but you can use parentheses to change the order of operations, so go off π
and if query is NULL? it retrieves all the nodes from the genders database. iconic behavior honestly.
a whole list of query examples is below, keep scrolling β¬οΈ
π₯ EXAMPLES π₯
these are the example queries you can pass to genders_testquery().
- test if a node contains the
mgmtorloginattribute:
"mgmt||login"
- test if a node is not a login node:
"all--login"
- test if a node is both a login node and ntp server:
"login&&ntpserv"
- test if a node is not a mgmt or login node:
"~(mgmt||login)"
β RETURN VALUES β
- if the node has met the conditions of the query β
1is returned β¨ - if the node does not meet the conditions β
0is returned π - on error β
-1is returned, and an error code is returned inhandle
you can grab that error code with genders_errnum(3), and a lil description of it with genders_strerror(3). the error codes themselves are defined in genders.h π
π ERRORS π
GENDERS_ERR_NULLHANDLEβ thehandleparameter isNULL. your genders handle has to be created withgenders_handle_create(3)first, no skipping steps bestie.GENDERS_ERR_NOTLOADEDβgenders_load_data(3)hasn't been called yet to load the genders data. nothing to query if you never loaded it πGENDERS_ERR_PARAMETERSβ an incorrect parameter has been passed in.GENDERS_ERR_SYNTAXβ there's a syntax error in the query. typo core πGENDERS_ERR_OUTMEMβmalloc(3)failed internally, meaning the system is out of memory.GENDERS_ERR_MAGICβhandlehas an incorrect magic number. that meanshandledoes not point to a genders handle, orhandlehas been destroyed bygenders_handle_destroy(3). she's gone, girl πGENDERS_ERR_INTERNALβ an internal system error has occurred.
π FILES π
/usr/include/genders.h
π SEE ALSO π
ngl this whole page is from LLNL, dated June 2004, and it's giving certified classic energy π go query something, main character π¦β¨
π¦ where this page comes from
- epel 10: libgenders-devel 1.28.1~^20231119git27b915d-5.el10_2 Β· GPL-2.0-only
- fedora 43: libgenders-devel 1.28.1~^20231119git27b915d-5.fc43 Β· GPL-2.0-only
- fedora 43: libgenders-devel 1.28.1~^20231119git27b915d-5.fc43 Β· GPL-2.0-only
- fedora 44: libgenders-devel 1.28.1~^20231119git27b915d-6.fc44 Β· GPL-2.0-only
- fedora 44: libgenders-devel 1.28.1~^20231119git27b915d-6.fc44 Β· GPL-2.0-only
- opensuse-leap 16.0: genders-devel 1.32-bp160.1.11 Β· GPL-2.0-or-later
- opensuse-leap 16.0: genders-devel 1.32-bp160.1.11 Β· GPL-2.0-or-later
- opensuse-leap 16.0: genders-devel 1.32-bp160.1.11 Β· GPL-2.0-or-later
- opensuse-leap 16.0: genders-devel 1.32-bp160.1.11 Β· GPL-2.0-or-later
- Copyright (C) 2007-2019 Lawrence Livermore National Security, LLC
- Copyright (C) 2001-2007 The Regents of the University of California
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms