You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we use 0 all over the place in the codebase, implicitly because it is the sentinel value that means "replace me when I am inserted in to a table with a sequence defined on my column". We should make a trait for this. I would propose something like:
trait AutoIncrementable {
/// A constant that will be replaced with a unique value upon insertion into a column with the `auto_inc` attribute.
const SENTINEL: Self;
}
or something like that in spacetimedb_lib. This can be used in the client SDK, module SDK, and in the core database for e.g. SystemIDs.
Note that "auto-inc" and "sequence" are used as synonyms throughout the codebase. We should probably also settle on one of these for consistency of documentation...
The text was updated successfully, but these errors were encountered:
/// A trait for types that know if their value will trigger a sequence./// This is used for auto-inc columns to determine if an insertion of a row/// will require the column to be updated in the row.////// For now, this is equivalent to a "is zero" test.pubtraitIsSequenceTrigger{/// Is this value one that will trigger a sequence, if any,/// when used as a column value.fnis_sequence_trigger(&self) -> bool;}
What implementations of is_sequence_trigger or values of SENTINEL other than the integer 0 would we want? I have a hard time imagining any case where we'd want to allow #[auto_inc] on non-integral types.
Currently we use
0
all over the place in the codebase, implicitly because it is the sentinel value that means "replace me when I am inserted in to a table with a sequence defined on my column". We should make a trait for this. I would propose something like:or something like that in
spacetimedb_lib
. This can be used in the client SDK, module SDK, and in the core database for e.g.SystemID
s.Note that "auto-inc" and "sequence" are used as synonyms throughout the codebase. We should probably also settle on one of these for consistency of documentation...
The text was updated successfully, but these errors were encountered: