Struct mentat_core::Attribute
[−]
[src]
pub struct Attribute { pub value_type: ValueType, pub multival: bool, pub unique: Option<Unique>, pub index: bool, pub fulltext: bool, pub component: bool, pub no_history: bool, }
A Mentat schema attribute has a value type and several other flags determining how assertions with the attribute are interpreted.
TODO: consider packing this into a bitfield or similar.
Fields
value_type: ValueType
The associated value type, i.e., :db/valueType
?
multival: bool
true
if this attribute is multi-valued, i.e., it is :db/cardinality :db.cardinality/many
. false
if this attribute is single-valued (the default), i.e., it
is :db/cardinality :db.cardinality/one
.
unique: Option<Unique>
None
if this attribute is neither unique-value nor unique-identity.
Some(attribute::Unique::Value)
if this attribute is unique-value, i.e., it is :db/unique :db.unique/value
.
Unique-value means that there is at most one assertion with the attribute and a particular value in the datom store. Unique-value attributes can be used in lookup-refs.
Some(attribute::Unique::Identity)
if this attribute is unique-identity, i.e., it is :db/unique :db.unique/identity
.
Unique-identity attributes always have value type Ref
.
Unique-identity means that the attribute is unique-value and that they can be used in lookup-refs and will automatically upsert where appropriate.
index: bool
true
if this attribute is automatically indexed, i.e., it is :db/indexing true
.
fulltext: bool
true
if this attribute is automatically fulltext indexed, i.e., it is :db/fulltext true
.
Fulltext attributes always have string values.
component: bool
true
if this attribute is a component, i.e., it is :db/isComponent true
.
Component attributes always have value type Ref
.
They are used to compose entities from component sub-entities: they are fetched recursively by pull expressions, and they are automatically recursively deleted where appropriate.
no_history: bool
true
if this attribute doesn't require history to be kept, i.e., it is :db/noHistory true
.
Methods
impl Attribute
[src]
impl Attribute
pub fn flags(&self) -> u8
[src]
pub fn flags(&self) -> u8
Combine several attribute flags into a bitfield used in temporary search tables.
pub fn to_edn_value(&self, ident: Option<Keyword>) -> Value
[src]
pub fn to_edn_value(&self, ident: Option<Keyword>) -> Value
Trait Implementations
impl Clone for Attribute
[src]
impl Clone for Attribute
fn clone(&self) -> Attribute
[src]
fn clone(&self) -> Attribute
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Attribute
[src]
impl Debug for Attribute
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Eq for Attribute
[src]
impl Eq for Attribute
impl Hash for Attribute
[src]
impl Hash for Attribute
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Ord for Attribute
[src]
impl Ord for Attribute
fn cmp(&self, __arg_0: &Attribute) -> Ordering
[src]
fn cmp(&self, __arg_0: &Attribute) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialOrd for Attribute
[src]
impl PartialOrd for Attribute
fn partial_cmp(&self, __arg_0: &Attribute) -> Option<Ordering>
[src]
fn partial_cmp(&self, __arg_0: &Attribute) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Attribute) -> bool
[src]
fn lt(&self, __arg_0: &Attribute) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Attribute) -> bool
[src]
fn le(&self, __arg_0: &Attribute) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Attribute) -> bool
[src]
fn gt(&self, __arg_0: &Attribute) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Attribute) -> bool
[src]
fn ge(&self, __arg_0: &Attribute) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl PartialEq for Attribute
[src]
impl PartialEq for Attribute
fn eq(&self, __arg_0: &Attribute) -> bool
[src]
fn eq(&self, __arg_0: &Attribute) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Attribute) -> bool
[src]
fn ne(&self, __arg_0: &Attribute) -> bool
This method tests for !=
.
impl Default for Attribute
[src]
impl Default for Attribute