insertEntity<T> method

void insertEntity <T>(T entity)

Insert a complete StanzaEntity into the database.

Implementation

void insertEntity<T>(T entity) {
  if (table.$type != T) {
    var msg =
        'Mismatch. The entity is Type $T. The table is type ${table.$type}';
    throw StanzaException(msg);
  }
  var map = table.toDb(entity);
  map.forEach((k, v) {
    _insert.insert(k, v, this);
  });
}