create method
If no mapping exists for key, associates it with value and
returns the commit-log sequence number; otherwise behaviour is
implementation-defined (typically throws).
Returns the commit-log sequence number assigned to this write,
or null if no sequence number was produced.
Throws a DataStoreException if the underlying store fails.
Implementation
@override
Future<int?> create(String key, AtData value,
{bool skipCommit = false}) async {
final k = _validateAndNormalize(key);
_checkMaxLength(k);
final toStore = AtData()
..data = value.data
..metaData =
AtMetadataBuilder(atSign: atSign, newAtMetaData: value.metaData)
.build();
final commitOp = _commitOpForNewWrite(value.metaData);
final result = _db.runInTransaction(() {
_upsertAtData(k, toStore);
return skipCommit ? -1 : _commitOrNull(k, commitOp);
});
_changes.add(KeyAdded(k));
return result;
}