ic-db-cli 0.52.1

Local fixture console for IC DB
Documentation
//! Relation contract shared by the local server and its bundled qualification fixture.
//! Decimal strings preserve all 64-bit values when the server returns JSON.
use serde::{Deserialize, Serialize};

/// An entry returned by a fixture lookup or included with a document.
#[derive(Serialize, Deserialize)]
pub struct EntryRow {
    /// Primary key as a decimal string.
    pub id: String,
    /// Entry category as a decimal string.
    pub category: String,
    /// Entry amount as a decimal string.
    pub amount: String,
}

/// A document and its optionally included entry.
#[derive(Serialize, Deserialize)]
pub struct DocumentRow {
    /// Primary key as a decimal string.
    pub id: String,
    /// Primary key of the referenced entry as a decimal string.
    pub entry_id: String,
    /// Document title.
    pub title: String,
    /// Optional document note.
    pub note: Option<String>,
    /// Whether the document is published.
    pub published: bool,
    /// Current score as a decimal string.
    pub score: String,
    /// Previous score, when recorded.
    pub previous_score: Option<String>,
    /// Priority, when assigned.
    pub priority: Option<String>,
    /// Referenced entry when requested.
    pub entry: Option<EntryRow>,
}

/// One page from the document relation query.
#[derive(Serialize, Deserialize)]
pub struct DocumentPage {
    /// Documents in query order.
    pub rows: Vec<DocumentRow>,
    /// Opaque cursor for the next page.
    pub next: Option<Vec<u8>>,
}

/// Selection and pagination for the document relation query.
#[derive(Serialize, Deserialize)]
pub struct Documents {
    /// Restrict results to this entry when supplied.
    pub entry_id: Option<u64>,
    /// Opaque cursor returned by the previous page.
    pub after: Option<Vec<u8>>,
    /// Maximum number of documents requested.
    pub take: u8,
    /// Whether to fetch each referenced entry.
    pub include_entry: bool,
}