Struct ruarango::coll::input::KeyOptionsBuilder
source · pub struct KeyOptionsBuilder { /* private fields */ }
Expand description
Builder for KeyOptions
.
Implementations§
source§impl KeyOptionsBuilder
impl KeyOptionsBuilder
sourcepub fn allow_user_keys(&mut self, value: bool) -> &mut Self
pub fn allow_user_keys(&mut self, value: bool) -> &mut Self
If set to true, then it is allowed to supply own key values in the _key attribute of a document. If set to false, then the key generator will solely be responsible for generating keys and supplying own key values in the _key attribute of documents is considered an error.
sourcepub fn kind<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn kind<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
specifies the type of the key generator. The currently available generators are traditional, autoincrement, uuid and padded.
The traditional key generator generates numerical keys in ascending order. The autoincrement key generator generates numerical keys in ascending order, the initial offset and the spacing can be configured (note: autoincrement is currently only +supported for non-sharded collections). The padded key generator generates keys of a fixed length (16 bytes) in ascending lexicographical sort order. This is ideal for usage with the RocksDB engine, which will slightly benefit keys that are inserted in lexicographically ascending order. The key generator can be used in a single-server or cluster. The uuid key generator generates universally unique 128 bit keys, which are stored in hexadecimal human-readable format. This key generator can be used in a single-server or cluster to generate “seemingly random” keys. The keys produced by this key generator are not lexicographically sorted.
sourcepub fn increment(&mut self, value: usize) -> &mut Self
pub fn increment(&mut self, value: usize) -> &mut Self
increment value for autoincrement key generator. Not used for other key generator types.
sourcepub fn offset(&mut self, value: usize) -> &mut Self
pub fn offset(&mut self, value: usize) -> &mut Self
Initial offset value for autoincrement key generator. Not used for other key generator types.
sourcepub fn build(&self) -> Result<KeyOptions, KeyOptionsBuilderError>
pub fn build(&self) -> Result<KeyOptions, KeyOptionsBuilderError>
Trait Implementations§
source§impl Clone for KeyOptionsBuilder
impl Clone for KeyOptionsBuilder
source§fn clone(&self) -> KeyOptionsBuilder
fn clone(&self) -> KeyOptionsBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more