searchByName method

dynamic searchByName(
  1. dynamic selectQuery,
  2. GlobalSearchParameters params,
  3. LocalSqlDataStore sql
)

Implementation

searchByName(
    selectQuery, GlobalSearchParameters params, LocalSqlDataStore sql) {
  return selectQuery.where(buildAnd([
    if (params.nameSearch != null)
      buildOr([
        sql.name.givenName.contains(
          params.nameSearch!,
        ),
        sql.name.familyName.contains(
          params.nameSearch!,
        ),
        buildOr([
          sql.name.givenName.contains(
            params.nameSearch!,
          ),
          sql.name.familyName.contains(
            params.nameSearch!,
          ),
          sql.name.otherNames.equals(
            params.nameSearch!,
          ),
        ]),
      ]),
  ]));
}