Struct core_traits::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]

[src]

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

[src]

Trait Implementations

impl Clone for Attribute
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Attribute
[src]

[src]

Formats the value using the given formatter. Read more

impl Eq for Attribute
[src]

impl Hash for Attribute
[src]

[src]

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

1.3.0
[src]

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

impl Ord for Attribute
[src]

[src]

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

1.21.0
[src]

Compares and returns the maximum of two values. Read more

1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl PartialOrd for Attribute
[src]

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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]

[src]

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

[src]

This method tests for !=.

impl Default for Attribute
[src]

[src]

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