hotdata 0.15.0

Powerful data platform API for datasets, queries, and analytics.
Documentation
/*
 * Hotdata API
 *
 * Powerful data platform API for instant 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};

/// ForkedFromInfo : Where a forked database came from, and which state of the source it copied.  Present only on a database that was created by forking another one. It is a record of how this database came to exist, not a live link: the fork and its source are independent from the moment the fork is created, and either can change or be deleted without affecting the other.  Forks created before lineage was recorded carry no `forked_from`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ForkedFromInfo {
    /// ID of the database that was forked. The database may since have been deleted — the record outlives it — so this is not guaranteed to resolve.
    #[serde(rename = "database_id")]
    pub database_id: String,
    /// When the fork was taken.
    #[serde(
        rename = "forked_at",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub forked_at: Option<Option<String>>,
    /// Display label the source carried when the fork was taken, kept so a deleted source still reads as more than an ID.
    #[serde(
        rename = "name",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub name: Option<Option<String>>,
    /// Marks the version of the source that this fork copied — its table set and their contents as of that moment. It is a point in time rather than a per-database revision count, so two forks of a source that did not change still report different values, and the numbers are not a way to tell whether a source has changed. Absent only on forks taken before the version was recorded.
    #[serde(
        rename = "snapshot_id",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub snapshot_id: Option<Option<i64>>,
}

impl ForkedFromInfo {
    /// Where a forked database came from, and which state of the source it copied.  Present only on a database that was created by forking another one. It is a record of how this database came to exist, not a live link: the fork and its source are independent from the moment the fork is created, and either can change or be deleted without affecting the other.  Forks created before lineage was recorded carry no `forked_from`.
    pub fn new(database_id: String) -> ForkedFromInfo {
        ForkedFromInfo {
            database_id,
            forked_at: None,
            name: None,
            snapshot_id: None,
        }
    }
}