create method
Creates a data item.
correlation_id
(optional) transaction id to trace execution through call chain.item
an item to be created. Return a created item.
Implementation
Future<T?> create(String? correlationId, T item) async {
if (item == null) {
return null;
}
var row = this.convertFromPublic_(item);
var columns = this.generateColumns_(row);
var params = this.generateParameters_(row);
var values = this.generateValues_(row);
var query = "INSERT INTO " +
this.quotedTableName_() +
" (" +
columns +
") VALUES (" +
params +
")";
var res = await client_!.query(query, values);
logger_.trace(correlationId, "Created in %s with id = %s",
[this.quotedTableName_(), row['id']]);
var newItem = item;
return newItem;
}