BaseQuery<T extends BaseEntity> constructor

BaseQuery<T extends BaseEntity>({
  1. Database? database,
  2. String? junctionOperator,
  3. List<String> selected = const [],
})

Implementation

BaseQuery({this.database, this.junctionOperator, this.selected = const []}) {
  this.repository = Repository<T>(database: database as Database);
  this.tableName = repository.entity.tableName;
  this.apiResourceName = repository.entity.apiResourceName;

  Iterable<Column> newColumns = repository.columns.where((column) =>
      column.relation == null ||
      column.relation?.relationType != RelationType.OneToMany);

  this.fields = newColumns.map((column) => column.name ?? '').toList();
  this.primaryKey = repository.columns.firstWhere((column) => column.primary);
}