hotdata 0.13.0

Powerful data platform API for datasets, queries, and analytics.
Documentation
/*
 * Hotdata API
 *
 * Powerful data platform API for managed databases, queries, and analytics.
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: developers@hotdata.dev
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// TableInfo : Single table metadata
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TableInfo {
    #[serde(
        rename = "columns",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub columns: Option<Option<Vec<models::ColumnInfo>>>,
    #[serde(rename = "connection")]
    pub connection: String,
    #[serde(
        rename = "last_sync",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub last_sync: Option<Option<String>>,
    /// The table's partition keys, in the order they were declared when the table was created. Empty when the table is not partitioned.  A table's storage layout is fixed when the table is created and cannot be changed afterwards, so this is how to confirm a table really was created with the layout that was asked for. The field is always present: an empty array means \"no partitioning declared\", which is not the same as a response that omits the field entirely.  Reported for tables in a hotdata-managed database, which are the only ones whose layout is declared here. A table discovered from an external connection always reports an empty array — its layout belongs to the upstream system, so an empty array there means \"not known from here\", not \"confirmed unpartitioned\".
    #[serde(rename = "partition_by")]
    pub partition_by: Vec<models::TablePartitionKey>,
    #[serde(rename = "schema")]
    pub schema: String,
    /// The table's sort keys, in the order they were declared when the table was created. Empty when no sort order was declared. Always present, and limited to tables in a hotdata-managed database, for the same reasons as `partition_by`.
    #[serde(rename = "sorted_by")]
    pub sorted_by: Vec<models::TableSortKey>,
    #[serde(rename = "synced")]
    pub synced: bool,
    #[serde(rename = "table")]
    pub table: String,
}

impl TableInfo {
    /// Single table metadata
    pub fn new(
        connection: String,
        partition_by: Vec<models::TablePartitionKey>,
        schema: String,
        sorted_by: Vec<models::TableSortKey>,
        synced: bool,
        table: String,
    ) -> TableInfo {
        TableInfo {
            columns: None,
            connection,
            last_sync: None,
            partition_by,
            schema,
            sorted_by,
            synced,
            table,
        }
    }
}