yawning_titan.db.query#
The query
module provides a Yawning-Titan extension to tinydb.queries.Query
.
Classes
The |
- class yawning_titan.db.query.YawningTitanQuery[source]#
The
YawningTitanQuery
class extendstinydb.queries.Query
.Extended to provide common pre-defined test functions that call
tinydb.queries.Query.test()
, rather than forcing the user to build a function/lambda function each time and pass it to test.- len_eq(i)[source]#
Tests the length of a field. This could be the length of a string or an array field.
Fields whose length matches
i
are returned in the search.- Example:
>>> from yawning_titan.networks.network_db import NetworkDB >>> from yawning_titan.db.query import YawningTitanQuery >>> db = NetworkDB() >>> db.search(YawningTitanQuery.matrix.len_eq(18)))
- len_lt(i)[source]#
Tests the length of a field. This could be the length of a string or an array field.
Fields whose length is less than
i
are returned in the search.- Example:
>>> from yawning_titan.networks.network_db import NetworkDB >>> from yawning_titan.db.query import YawningTitanQuery >>> db = NetworkDB() >>> db.search(YawningTitanQuery.matrix.len_lt(18)))
- len_le(i)[source]#
Tests the length of a field. This could be the length of a string or an array field.
Fields whose length is less than or equal to
i
are returned in the search.- Example:
>>> from yawning_titan.networks.network_db import NetworkDB >>> from yawning_titan.db.query import YawningTitanQuery >>> db = NetworkDB() >>> db.search(YawningTitanQuery.matrix.len_le(18)))
- len_gt(i)[source]#
Tests the length of a field. This could be the length of a string or an array field.
Fields whose length is greater than
i
are returned in the search.- Example:
>>> from yawning_titan.networks.network_db import NetworkDB >>> from yawning_titan.db.query import YawningTitanQuery >>> db = NetworkDB() >>> db.search(YawningTitanQuery.matrix.len_gt(18)))
- len_ge(i)[source]#
Tests the length of a field. This could be the length of a string or an array field.
Fields whose length is greater than or equal to
i
are returned in the search.- Example:
>>> from yawning_titan.networks.network_db import NetworkDB >>> from yawning_titan.db.query import YawningTitanQuery >>> db = NetworkDB() >>> db.search(YawningTitanQuery.matrix.len_ge(18)))
- len_bt(i, j)[source]#
Tests the length of a field. This could be the length of a string or an array field.
Fields whose length is greater than or equal to
i
are returned in the search.- Example:
>>> from yawning_titan.networks.network_db import NetworkDB >>> from yawning_titan.db.query import YawningTitanQuery >>> db = NetworkDB() >>> db.search(YawningTitanQuery.matrix.len_bt(1,18)))
- Parameters:
i – The minimum length of a field as an int.
j – The maximum length of a field as an int.
- Returns:
True
if it does exist, otherwiseFalse
. if the field length is greater than or equal toi
and less than or equal toj
, otherwiseFalse
.- Raises:
TypeError – When the field
len_bt()
is called on does not have alen()
function.
- bt(i, j)[source]#
Tests the value of a field. This could be the value of a string or an array field.
Fields whose value is greater than or equal to
i
are returned in the search.- Example:
>>> from yawning_titan.networks.network_db import NetworkDB >>> from yawning_titan.db.query import YawningTitanQuery >>> db = NetworkDB() >>> db.search(YawningTitanQuery.matrix.len_bt(1,18)))
- Parameters:
i – The minimum value of a field as an int.
j – The maximum value of a field as an int.
- Returns:
True
if it does exist, otherwiseFalse
. if the field value is greater than or equal toi
and less than or equal toj
, otherwiseFalse
.- Raises:
TypeError – When the field
len_bt()
is called on does not have alen()
function.