Skip to main content

libpgdump/
entry.rs

1use crate::types::{ObjectType, OffsetState, Section};
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub struct Entry {
5    pub dump_id: i32,
6    pub had_dumper: bool,
7    pub table_oid: String,
8    pub oid: String,
9    pub tag: Option<String>,
10    pub desc: ObjectType,
11    pub section: Section,
12    pub defn: Option<String>,
13    pub drop_stmt: Option<String>,
14    pub copy_stmt: Option<String>,
15    pub namespace: Option<String>,
16    pub tablespace: Option<String>,
17    pub tableam: Option<String>,
18    pub relkind: Option<char>,
19    pub owner: Option<String>,
20    pub with_oids: bool,
21    pub dependencies: Vec<i32>,
22    /// Custom format: offset state (set, not set, no data).
23    pub data_state: OffsetState,
24    /// Custom format: byte offset of this entry's data in the archive file.
25    pub offset: u64,
26    /// Directory/tar format: relative filename for this entry's data file.
27    pub filename: Option<String>,
28}
29
30impl Entry {
31    /// Computes the section from the object type.
32    ///
33    /// This is a derived value and may differ from [`Entry::section`], which
34    /// holds the section as read from the archive file.
35    pub fn computed_section(&self) -> Section {
36        self.desc.section()
37    }
38}