indexOf method

IntField indexOf(
  1. dynamic str
)

Get db int field with the starct index of contained str, if not contained, returned field value will be -1.

Implementation

IntField indexOf(dynamic str) {
  assert(str is String || str is StringField);

  var result = IntField();
  result.queryBuilder = () => str is StringField
      ? 'INSTR(${buildQuery()},${str.buildQuery()})'
      : 'INSTR(${buildQuery()},?)';
  result.parametersBuilder =
      () => getParameters()..addAll([if (str is String) str]);
  return result;
}