getEntityColumns static method

List<Column> getEntityColumns(
  1. ClassMirror entityClassMirror,
  2. bool ignoreRelationColumns
)

Implementation

static List<Column> getEntityColumns(
    ClassMirror entityClassMirror, bool ignoreRelationColumns) {
  List<Column> columns = [];

  for (String key
      in entityClassMirror.superclass!.superclass!.declarations.keys) {
    var value = entityClassMirror.superclass!.superclass!.declarations[key];

    if (value is VariableMirror) {
      VariableMirror variableMirror = value;
      Column? column =
          Column.getColumn(variableMirror, key, ignoreRelationColumns);

      if (column != null) {
        columns.add(column);
      }
    }
  }

  for (String key in entityClassMirror.superclass!.declarations.keys) {
    var value = entityClassMirror.superclass!.declarations[key];

    if (value is VariableMirror) {
      VariableMirror variableMirror = value;
      Column? column =
          Column.getColumn(variableMirror, key, ignoreRelationColumns);

      if (column != null) {
        columns.add(column);
      }
    }
  }

  for (String key in entityClassMirror.declarations.keys) {
    var value = entityClassMirror.declarations[key];
    if (value is VariableMirror) {
      VariableMirror variableMirror = value;
      Column column =
          Column.getColumn(variableMirror, key, ignoreRelationColumns)
              as Column;
      columns.add(column);
    }
  }

  return columns;
}