SchemaObject

Struct SchemaObject 

Source
pub struct SchemaObject {
Show 13 fields pub id: Option<String>, pub name: String, pub physical_name: Option<String>, pub physical_type: Option<String>, pub business_name: Option<String>, pub description: Option<String>, pub data_granularity_description: Option<String>, pub properties: Vec<Property>, pub relationships: Vec<SchemaRelationship>, pub quality: Vec<QualityRule>, pub authoritative_definitions: Vec<AuthoritativeDefinition>, pub tags: Vec<String>, pub custom_properties: Vec<CustomProperty>,
}
Expand description

SchemaObject - one table/view/topic in a contract (ODCS v3.1.0)

Schema objects represent individual data structures within a contract. Each schema object contains properties (columns) and can have its own metadata like quality rules, relationships, and authoritative definitions.

§Example

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

let users_table = SchemaObject::new("users")
    .with_physical_name("tbl_users")
    .with_physical_type("table")
    .with_business_name("User Accounts")
    .with_description("Contains registered user information")
    .with_properties(vec![
        Property::new("id", "integer").with_primary_key(true),
        Property::new("email", "string").with_required(true),
        Property::new("name", "string"),
    ]);

Fields§

§id: Option<String>

Stable technical identifier

§name: String

Schema object name (table/view name)

§physical_name: Option<String>

Physical name in the data source

§physical_type: Option<String>

Physical type (“table”, “view”, “topic”, “file”, “object”, “stream”)

§business_name: Option<String>

Business name for the schema object

§description: Option<String>

Schema object description/documentation

§data_granularity_description: Option<String>

Description of the data granularity (e.g., “One row per customer per day”)

§properties: Vec<Property>

List of properties/columns in this schema object

§relationships: Vec<SchemaRelationship>

Schema-level relationships to other schema objects

§quality: Vec<QualityRule>

Quality rules and checks at schema level

§authoritative_definitions: Vec<AuthoritativeDefinition>

Authoritative definitions for this schema object

§tags: Vec<String>

Schema-level tags

§custom_properties: Vec<CustomProperty>

Custom properties for format-specific metadata

Implementations§

Source§

impl SchemaObject

Source

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

Create a new schema object with the given name

Source

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

Set the physical name

Source

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

Set the physical type

Source

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

Set the business name

Source

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

Set the description

Source

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

Set the data granularity description

Source

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

Set the properties (columns)

Source

pub fn with_property(self, property: Property) -> Self

Add a property

Source

pub fn with_relationships(self, relationships: Vec<SchemaRelationship>) -> Self

Set the relationships

Source

pub fn with_relationship(self, relationship: SchemaRelationship) -> Self

Add a relationship

Source

pub fn with_quality(self, quality: Vec<QualityRule>) -> Self

Set the quality rules

Source

pub fn with_quality_rule(self, rule: QualityRule) -> Self

Add a quality rule

Source

pub fn with_authoritative_definitions( self, definitions: Vec<AuthoritativeDefinition>, ) -> Self

Set the authoritative definitions

Source

pub fn with_authoritative_definition( self, definition: AuthoritativeDefinition, ) -> Self

Add an authoritative definition

Source

pub fn with_tags(self, tags: Vec<String>) -> Self

Set the tags

Source

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

Add a tag

Source

pub fn with_custom_properties( self, custom_properties: Vec<CustomProperty>, ) -> Self

Set the custom properties

Source

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

Add a custom property

Source

pub fn with_id(self, id: impl Into<String>) -> Self

Set the ID

Source

pub fn primary_key_properties(&self) -> Vec<&Property>

Get the primary key properties

Source

pub fn required_properties(&self) -> Vec<&Property>

Get the required properties

Source

pub fn get_property(&self, name: &str) -> Option<&Property>

Get a property by name

Source

pub fn get_property_mut(&mut self, name: &str) -> Option<&mut Property>

Get a mutable property by name

Source

pub fn property_count(&self) -> usize

Count of properties

Source

pub fn has_nested_properties(&self) -> bool

Check if this schema has any nested/complex properties

Trait Implementations§

Source§

impl Clone for SchemaObject

Source§

fn clone(&self) -> SchemaObject

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 SchemaObject

Source§

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

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

impl Default for SchemaObject

Source§

fn default() -> SchemaObject

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

impl<'de> Deserialize<'de> for SchemaObject

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<&SchemaObject> for Table

Source§

fn from(schema: &SchemaObject) -> Self

Convert a SchemaObject to a Table

This flattens nested properties to dot-notation column names.

Source§

impl From<&Table> for SchemaObject

Source§

fn from(table: &Table) -> Self

Convert a Table to a SchemaObject

This reconstructs nested property structure from dot-notation column names.

Source§

impl PartialEq for SchemaObject

Source§

fn eq(&self, other: &SchemaObject) -> 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 SchemaObject

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 SchemaObject

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>,