compile method

void compile(
  1. StringBuffer buf,
  2. int indent
)

Implementation

void compile(StringBuffer buf, int indent) {
  var i = 0;

  while (_stack.isNotEmpty) {
    var str = _stack.removeFirst();

    if (i++ > 0) buf.writeln(',');

    for (var i = 0; i < indent; i++) {
      buf.write('  ');
    }

    buf.write(str);
  }

  if (i > 0) buf.writeln(';');

  i = 0;
  _columns.forEach((name, column) {
    var col = PostgresGenerator.compileColumn(column);
    if (i++ > 0) buf.writeln(',');

    for (var i = 0; i < indent; i++) {
      buf.write('  ');
    }

    buf.write('ADD COLUMN "$name" $col');
  });
}