Property

Struct Property 

Source
pub struct Property {
Show 31 fields pub id: Option<String>, pub name: String, pub business_name: Option<String>, pub description: Option<String>, pub logical_type: String, pub physical_type: Option<String>, pub physical_name: Option<String>, pub logical_type_options: Option<LogicalTypeOptions>, pub required: bool, pub primary_key: bool, pub primary_key_position: Option<i32>, pub unique: bool, pub partitioned: bool, pub partition_key_position: Option<i32>, pub clustered: bool, pub classification: Option<String>, pub critical_data_element: bool, pub encrypted_name: Option<String>, pub transform_source_objects: Vec<String>, pub transform_logic: Option<String>, pub transform_description: Option<String>, pub examples: Vec<Value>, pub default_value: Option<Value>, pub relationships: Vec<PropertyRelationship>, pub authoritative_definitions: Vec<AuthoritativeDefinition>, pub quality: Vec<QualityRule>, pub enum_values: Vec<String>, pub tags: Vec<String>, pub custom_properties: Vec<CustomProperty>, pub items: Option<Box<Property>>, pub properties: Vec<Property>,
}
Expand description

Property - one column in a schema object (ODCS v3.1.0)

Properties represent individual fields in a schema. They support nested structures through the properties field (for OBJECT types) and the items field (for ARRAY types).

§Example

use data_modelling_core::models::odcs::{Property, LogicalTypeOptions};

// Simple property
let id_prop = Property::new("id", "integer")
    .with_primary_key(true)
    .with_required(true);

// Nested object property
let address_prop = Property::new("address", "object")
    .with_nested_properties(vec![
        Property::new("street", "string"),
        Property::new("city", "string"),
        Property::new("zip", "string"),
    ]);

// Array property
let tags_prop = Property::new("tags", "array")
    .with_items(Property::new("", "string"));

Fields§

§id: Option<String>

Stable technical identifier

§name: String

Property name

§business_name: Option<String>

Business name for the property

§description: Option<String>

Property description/documentation

§logical_type: String

Logical data type (e.g., “string”, “integer”, “number”, “boolean”, “object”, “array”)

§physical_type: Option<String>

Physical database type (e.g., “VARCHAR(100)”, “BIGINT”)

§physical_name: Option<String>

Physical name in the data source

§logical_type_options: Option<LogicalTypeOptions>

Additional type options (min/max length, pattern, precision, etc.)

§required: bool

Whether the property is required (inverse of nullable)

§primary_key: bool

Whether this property is part of the primary key

§primary_key_position: Option<i32>

Position in composite primary key, 1-based

§unique: bool

Whether the property contains unique values

§partitioned: bool

Whether the property is used for partitioning

§partition_key_position: Option<i32>

Position in partition key, 1-based

§clustered: bool

Whether the property is used for clustering

§classification: Option<String>

Data classification level (e.g., “confidential”, “public”)

§critical_data_element: bool

Whether this is a critical data element

§encrypted_name: Option<String>

Name of the encrypted version of this property

§transform_source_objects: Vec<String>

Source objects used in transformation

§transform_logic: Option<String>

Transformation logic/expression

§transform_description: Option<String>

Human-readable transformation description

§examples: Vec<Value>

Example values for this property

§default_value: Option<Value>

Default value for the property

§relationships: Vec<PropertyRelationship>

Property-level relationships

§authoritative_definitions: Vec<AuthoritativeDefinition>

Authoritative definitions

§quality: Vec<QualityRule>

Quality rules and checks

§enum_values: Vec<String>

Enum values if this property is an enumeration type

§tags: Vec<String>

Property-level tags

§custom_properties: Vec<CustomProperty>

Custom properties for format-specific metadata

§items: Option<Box<Property>>

For ARRAY types: the item type definition

§properties: Vec<Property>

For OBJECT types: nested property definitions

Implementations§

Source§

impl Property

Source

pub fn new(name: impl Into<String>, logical_type: impl Into<String>) -> Self

Create a new property with the given name and logical type

Source

pub fn with_required(self, required: bool) -> Self

Set the property as required

Source

pub fn with_primary_key(self, primary_key: bool) -> Self

Set the property as a primary key

Source

pub fn with_primary_key_position(self, position: i32) -> Self

Set the primary key position

Source

pub fn with_description(self, description: impl Into<String>) -> Self

Set the property description

Source

pub fn with_business_name(self, business_name: impl Into<String>) -> Self

Set the business name

Source

pub fn with_physical_type(self, physical_type: impl Into<String>) -> Self

Set the physical type

Source

pub fn with_physical_name(self, physical_name: impl Into<String>) -> Self

Set the physical name

Source

pub fn with_nested_properties(self, properties: Vec<Property>) -> Self

Set nested properties (for OBJECT types)

Source

pub fn with_items(self, items: Property) -> Self

Set items property (for ARRAY types)

Source

pub fn with_enum_values(self, values: Vec<String>) -> Self

Set enum values

Source

pub fn with_custom_property(self, property: CustomProperty) -> Self

Add a custom property

Source

pub fn with_tag(self, tag: impl Into<String>) -> Self

Add a tag

Source

pub fn with_unique(self, unique: bool) -> Self

Set unique constraint

Source

pub fn with_classification(self, classification: impl Into<String>) -> Self

Set classification

Source

pub fn has_nested_structure(&self) -> bool

Check if this property has nested structure (OBJECT or ARRAY type)

Source

pub fn is_object(&self) -> bool

Check if this is an object type

Source

pub fn is_array(&self) -> bool

Check if this is an array type

Source

pub fn flatten_to_paths(&self) -> Vec<(String, &Property)>

Get all nested properties recursively, returning (path, property) pairs Path uses dot notation for nested objects and [] for arrays

Source

pub fn from_flat_paths(paths: &[(String, Property)]) -> Vec<Property>

Create a property tree from a list of flattened columns with dot-notation names

This reconstructs the hierarchical structure from paths like:

  • “address.street” -> nested object
  • “tags.[]” -> array items
  • “items.[].name” -> array of objects

Trait Implementations§

Source§

impl Clone for Property

Source§

fn clone(&self) -> Property

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Property

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Property

Source§

fn default() -> Property

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Property

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&Column> for Property

Source§

fn from(col: &Column) -> Self

Convert a Column to a Property

Note: This creates a flat property. To reconstruct nested structure from dot-notation column names, use Property::from_flat_paths().

Source§

impl From<&Property> for Column

Source§

fn from(prop: &Property) -> Self

Convert a Property to a Column

This flattens nested properties to dot-notation names for backwards compatibility. For example, a nested property address.street becomes a column named “address.street”.

Source§

impl PartialEq for Property

Source§

fn eq(&self, other: &Property) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Property

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Property

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,