Struct mentat_db::types::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

[]

The associated value type, i.e., :db/valueType?

[]

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.

[]

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.

[]

true if this attribute is automatically indexed, i.e., it is :db/indexing true.

[]

true if this attribute is automatically fulltext indexed, i.e., it is :db/fulltext true.

Fulltext attributes always have string values.

[]

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.

[]

true if this attribute doesn't require history to be kept, i.e., it is :db/noHistory true.

Methods

impl Attribute
[src]
[]

[]

Combine several attribute flags into a bitfield used in temporary search tables.

Trait Implementations

impl Default for Attribute
[src]
[+]

[]

Returns the "default value" for a type. Read more

impl PartialOrd<Attribute> for Attribute
[src]
[+]

[]

This method returns an ordering between self and other values if one exists. Read more

[]

This method tests less than (for self and other) and is used by the < operator. Read more

[]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[]

This method tests greater than (for self and other) and is used by the > operator. Read more

[]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Clone for Attribute
[src]
[+]

[]

Returns a copy of the value. Read more

[]

Performs copy-assignment from source. Read more

impl Ord for Attribute
[src]
[+]

[]

This method returns an Ordering between self and other. Read more

[]

Compares and returns the maximum of two values. Read more

[]

Compares and returns the minimum of two values. Read more

impl Hash for Attribute
[src]
[+]

[]

Feeds this value into the given [Hasher]. Read more

[]

Feeds a slice of this type into the given [Hasher]. Read more

impl Eq for Attribute
[src]

impl PartialEq<Attribute> for Attribute
[src]
[+]

[]

This method tests for self and other values to be equal, and is used by ==. Read more

[]

This method tests for !=.

impl Debug for Attribute
[src]
[+]

[]

Formats the value using the given formatter. Read more

impl AttributeValidation for Attribute
[src]
[+]

Auto Trait Implementations

impl Send for Attribute

impl Sync for Attribute