Closed jafri closed 2 years ago
get primary(): u64 { if (!this.isOk()) { return 0; } if (this._primary != UNKNOWN_PRIMARY_KEY) { return this._primary; } let value = this.value; this._primary = value!.getPrimaryValue(); return this._primary; }
returning 0 as primary key is dangerous on !isOk()... that may be a valid existing primary key on another iterator
Primary key is always the same, so at no point should it return 0 like that
I think the best practice is to check the iterator before using primary.
What's your recommendation? Should we throw an error if the iterator is invalid?
Improved by f77bccb904df854991fcf9d348433140d68892f7
returning 0 as primary key is dangerous on !isOk()... that may be a valid existing primary key on another iterator
Primary key is always the same, so at no point should it return 0 like that