DVRecordTable class
Constructors
DVRecordTable ({required String table , required String key , required List <String > columns , Set <String > sensitive = const <String>{} , Set <String > unique = const <String>{} , DVHistory ? history , bool versioned = true , bool softDelete = false , DVCapture ? capture , DVRecordScope ? scope , Map <String , String > ? types , DVDatabaseAdapter ? database })
Properties
capture
→ DVCapture ?
The change capture log every write is recorded to, or null when the
model is not captured. Sensitive fields are left out of it.
final
columns
→ List <String >
final
database
→ DVDatabaseAdapter
Where the rows live: the adapter given, or the configured database.
no setter
hashCode
→ int
The hash code for this object.
no setter inherited
historyPolicy
→ DVHistory ?
Null when this table keeps no change log.
final
historyTable
→ String
Where the change log lives.
no setter
key
→ String
final
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
scope
→ DVRecordScope ?
The rows this table may see, or null for the whole table.
final
sensitive
→ Set <String >
Fields recorded as changed, never as values.
final
softDelete
→ bool
Whether delete marks the row rather than removing it.
final
table
→ String
final
types
→ Map <String , String > ?
The SQL type of each column, or null to declare none.
final
unique
→ Set <String >
Fields a restore must not duplicate among live records.
final
versioned
→ bool
Whether writes are checked against the version they read. false is for
append-only data where writes never contend, and says so where the table
is declared.
final
Methods
all ({bool withDeleted = false })
→ Future <List <DVRecord > >
Every record, excluding soft-deleted ones unless withDeleted.
delete (Object id , {DVRecord ? base , String ? actor , String ? tenant })
→ Future <void >
Deletes the record: marks it when softDelete , removes it otherwise.
ensureSchema ()
→ Future <void >
Creates the table, and its history table when history is enabled.
history (Object id )
→ Future <List <DVHistoryEntry > >
The record's change log, oldest first. Empty when history is off.
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prune ({DateTime ? now })
→ Future <int >
Removes history entries older than DVHistory.keep (DV-HISTORY-004),
returning how many. Never touches the records themselves.
read (Object id , {bool withDeleted = false })
→ Future <DVRecord ? >
The record with id, or null. A soft-deleted record is null unless
withDeleted.
restore (Object id , {String ? actor , String ? tenant })
→ Future <DVRecord >
Restores a soft-deleted record.
revert (Object id , {required DVHistoryEntry to , DVRecord ? base , String ? actor , String ? tenant })
→ Future <DVRevertResult >
Puts the record back as it was after to, as a new change.
toString ()
→ String
A string representation of this object.
inherited
write (Map <String , Object ? > values , {DVRecord ? base , DVConflict onConflict = DVConflict.ask , String ? actor , String ? tenant })
→ Future <DVWriteResult >
Stores values: inserts a new record, or updates an existing one
checked against base, the record as this writer read it.