andWhere()
You can use the andWhere()
function to filter data. There are different versions of this function.
INFO
You should call the resource()
function before using this function.
INFO
You should call the paginate()
function after using this function.
TIP
andWhere()
function is just an alias for the where()
function.
andWhere(field, value)
ts
import api from "axe-api-client";
// ...
const response = api
.resource("users")
.where("name", "Karl")
.andWhere("surname", "Popper")
.paginate();
field
: The field name on the resource.value
: The value of the field.
sql
WHERE `name` = 'Karl' AND `surname` = 'Popper'
andWhere(field, condition, value)
ts
import api from "axe-api-client";
// ...
const response = api
.resource("users")
.where("name", "Karl")
.andWhere("surname", "<>", "Karl")
.paginate();
field
: The field name on the resource.condition
: The conditon parameter. You can use the following conditions;=
<>
>
>=
<
<=
value
: The value of the field.
sql
WHERE `name` = 'Karl' AND `surname` <> 'Popper'
andWhere((q: IQueryable) => IQueryable)
ts
import api from "axe-api-client";
// ...
const response = api
.resource("users")
.where("id", ">", 100)
.where((query: IQueryable) => {
return query.where("name", "Karl").andWhere("surname", "Popper");
})
.paginate();
queryFunction
: The query function
sql
WHERE `id` > 100 AND (`name` = 'Karl' or `surname` = 'Popper')