sql_query

void main() {
  await DB.init(
    databaseName: 'sesuatu',
    tableList: [
      Produk.tables(),
    ],
  );
}


class Produk {
  static const table = 'produk';
  static const id = 'id';
  static const pNama = 'p_nama';
  static const createdAt = 'created_at';

  static final column = [
    ColumnDatabase(name: id, typeData: DataType.integer, primaryKey: true, autoIncrement: true),
    ColumnDatabase(name: pNama, typeData: DataType.text),
    ColumnDatabase(name: createdAt, typeData: DataType.double),
  ];

  static tables() {
    return TableDatabase(
      tableName: table,
      column: column,
    );
  }

  static get() async {
    final gt = DB.table(table);
    gt.where(createdAt, '<=', DateTime.now().millisecondsSinceEpoch.toString());
    return await gt.get();
  }
}