Trait typedb_driver::transaction::concept::api::AttributeTypeAPI
source · pub trait AttributeTypeAPI: ThingTypeAPI + Clone + Into<AttributeType> {
Show 13 methods
// Required method
fn value_type(&self) -> ValueType;
// Provided methods
fn put<'tx>(
&self,
transaction: &'tx Transaction<'_>,
value: Value
) -> BoxPromise<'tx, Result<Attribute>> { ... }
fn get<'tx>(
&self,
transaction: &'tx Transaction<'_>,
value: Value
) -> BoxPromise<'tx, Result<Option<Attribute>>> { ... }
fn get_supertype<'tx>(
&self,
transaction: &'tx Transaction<'_>
) -> BoxPromise<'tx, Result<Option<AttributeType>>> { ... }
fn set_supertype<'tx>(
&mut self,
transaction: &'tx Transaction<'_>,
supertype: AttributeType
) -> BoxPromise<'tx, Result> { ... }
fn get_supertypes<'tx>(
&self,
transaction: &'tx Transaction<'_>
) -> Result<BoxStream<'tx, Result<AttributeType>>> { ... }
fn get_subtypes<'tx>(
&self,
transaction: &'tx Transaction<'_>,
transitivity: Transitivity
) -> Result<BoxStream<'tx, Result<AttributeType>>> { ... }
fn get_subtypes_with_value_type<'tx>(
&self,
transaction: &'tx Transaction<'_>,
value_type: ValueType,
transitivity: Transitivity
) -> Result<BoxStream<'tx, Result<AttributeType>>> { ... }
fn get_instances<'tx>(
&self,
transaction: &'tx Transaction<'_>,
transitivity: Transitivity
) -> Result<BoxStream<'tx, Result<Attribute>>> { ... }
fn get_regex<'tx>(
&self,
transaction: &'tx Transaction<'_>
) -> BoxPromise<'tx, Result<Option<String>>> { ... }
fn set_regex<'tx>(
&self,
transaction: &'tx Transaction<'_>,
regex: String
) -> BoxPromise<'tx, Result> { ... }
fn unset_regex<'tx>(
&self,
transaction: &'tx Transaction<'_>
) -> BoxPromise<'tx, Result> { ... }
fn get_owners<'tx>(
&self,
transaction: &'tx Transaction<'_>,
transitivity: Transitivity,
annotations: Vec<Annotation>
) -> Result<BoxStream<'tx, Result<ThingType>>> { ... }
}Required Methods§
sourcefn value_type(&self) -> ValueType
fn value_type(&self) -> ValueType
Provided Methods§
sourcefn put<'tx>(
&self,
transaction: &'tx Transaction<'_>,
value: Value
) -> BoxPromise<'tx, Result<Attribute>>
fn put<'tx>( &self, transaction: &'tx Transaction<'_>, value: Value ) -> BoxPromise<'tx, Result<Attribute>>
sourcefn get<'tx>(
&self,
transaction: &'tx Transaction<'_>,
value: Value
) -> BoxPromise<'tx, Result<Option<Attribute>>>
fn get<'tx>( &self, transaction: &'tx Transaction<'_>, value: Value ) -> BoxPromise<'tx, Result<Option<Attribute>>>
sourcefn get_supertype<'tx>(
&self,
transaction: &'tx Transaction<'_>
) -> BoxPromise<'tx, Result<Option<AttributeType>>>
fn get_supertype<'tx>( &self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result<Option<AttributeType>>>
sourcefn set_supertype<'tx>(
&mut self,
transaction: &'tx Transaction<'_>,
supertype: AttributeType
) -> BoxPromise<'tx, Result>
fn set_supertype<'tx>( &mut self, transaction: &'tx Transaction<'_>, supertype: AttributeType ) -> BoxPromise<'tx, Result>
sourcefn get_supertypes<'tx>(
&self,
transaction: &'tx Transaction<'_>
) -> Result<BoxStream<'tx, Result<AttributeType>>>
fn get_supertypes<'tx>( &self, transaction: &'tx Transaction<'_> ) -> Result<BoxStream<'tx, Result<AttributeType>>>
sourcefn get_subtypes<'tx>(
&self,
transaction: &'tx Transaction<'_>,
transitivity: Transitivity
) -> Result<BoxStream<'tx, Result<AttributeType>>>
fn get_subtypes<'tx>( &self, transaction: &'tx Transaction<'_>, transitivity: Transitivity ) -> Result<BoxStream<'tx, Result<AttributeType>>>
Retrieves all direct and indirect (or direct only) subtypes of this AttributeType.
Arguments
transaction– The current transactiontransitivity–Transitivity::Transitivefor direct and indirect subtypes,Transitivity::Explicitfor direct subtypes only
Examples
attribute_type.get_subtypes(transaction, transitivity)sourcefn get_subtypes_with_value_type<'tx>(
&self,
transaction: &'tx Transaction<'_>,
value_type: ValueType,
transitivity: Transitivity
) -> Result<BoxStream<'tx, Result<AttributeType>>>
fn get_subtypes_with_value_type<'tx>( &self, transaction: &'tx Transaction<'_>, value_type: ValueType, transitivity: Transitivity ) -> Result<BoxStream<'tx, Result<AttributeType>>>
Retrieves all direct and indirect (or direct only) subtypes of this AttributeType
with given ValueType.
Arguments
transaction– The current transactionvalue_type–ValueTypefor retrieving subtypestransitivity–Transitivity::Transitivefor direct and indirect subtypes,Transitivity::Explicitfor direct subtypes only
Examples
attribute_type.get_subtypes_with_value_type(transaction, value_type, transitivity)sourcefn get_instances<'tx>(
&self,
transaction: &'tx Transaction<'_>,
transitivity: Transitivity
) -> Result<BoxStream<'tx, Result<Attribute>>>
fn get_instances<'tx>( &self, transaction: &'tx Transaction<'_>, transitivity: Transitivity ) -> Result<BoxStream<'tx, Result<Attribute>>>
Retrieves all direct and indirect (or direct only) Attributes that are instances
of this AttributeType.
Arguments
transaction– The current transactiontransitivity–Transitivity::Transitivefor direct and indirect subtypes,Transitivity::Explicitfor direct subtypes only
Examples
attribute_type.get_instances(transaction, transitivity)sourcefn get_regex<'tx>(
&self,
transaction: &'tx Transaction<'_>
) -> BoxPromise<'tx, Result<Option<String>>>
fn get_regex<'tx>( &self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result<Option<String>>>
sourcefn set_regex<'tx>(
&self,
transaction: &'tx Transaction<'_>,
regex: String
) -> BoxPromise<'tx, Result>
fn set_regex<'tx>( &self, transaction: &'tx Transaction<'_>, regex: String ) -> BoxPromise<'tx, Result>
Sets a regular expression as a constraint for this AttributeType. Values of all
Attributes of this type (inserted earlier or later) should match this regex.
Can only be applied for AttributeTypes with a string value type.
Arguments
transaction– The current transactionregex– Regular expression
Examples
attribute_type.set_regex(transaction, regex).await;sourcefn unset_regex<'tx>(
&self,
transaction: &'tx Transaction<'_>
) -> BoxPromise<'tx, Result>
fn unset_regex<'tx>( &self, transaction: &'tx Transaction<'_> ) -> BoxPromise<'tx, Result>
sourcefn get_owners<'tx>(
&self,
transaction: &'tx Transaction<'_>,
transitivity: Transitivity,
annotations: Vec<Annotation>
) -> Result<BoxStream<'tx, Result<ThingType>>>
fn get_owners<'tx>( &self, transaction: &'tx Transaction<'_>, transitivity: Transitivity, annotations: Vec<Annotation> ) -> Result<BoxStream<'tx, Result<ThingType>>>
Retrieve all Things that own an attribute of this AttributeType
and have all given Annotations.
Arguments
transaction– The current transactiontransitivity–Transitivity::Transitivefor direct and inherited ownership,Transitivity::Explicitfor direct ownership onlyannotations– Only retrieveThingTypesthat have an attribute of thisAttributeTypewith all givenAnnotations
Examples
attribute_type.get_owners(transaction, transitivity, annotations)Object Safety§
This trait is not object safe.