[][src]Struct ena::pgsql::core::Post

pub struct Post {
    pub no: i64,
    pub subnum: Option<i64>,
    pub tim: Option<i64>,
    pub resto: i64,
    pub time: i64,
    pub last_modified: i64,
    pub archived_on: Option<i64>,
    pub deleted_on: Option<i64>,
    pub fsize: Option<i32>,
    pub w: Option<i32>,
    pub h: Option<i32>,
    pub replies: Option<i32>,
    pub images: Option<i32>,
    pub unique_ips: Option<i32>,
    pub tn_w: Option<i16>,
    pub tn_h: Option<i16>,
    pub custom_spoiler: Option<i16>,
    pub since4pass: Option<i16>,
    pub sticky: Option<bool>,
    pub closed: Option<bool>,
    pub filedeleted: Option<bool>,
    pub spoiler: Option<bool>,
    pub m_img: Option<bool>,
    pub bumplimit: Option<bool>,
    pub imagelimit: Option<bool>,
    pub name: Option<String>,
    pub sub: Option<String>,
    pub com: Option<String>,
    pub filename: Option<String>,
    pub ext: Option<String>,
    pub trip: Option<String>,
    pub id: Option<String>,
    pub capcode: Option<String>,
    pub country: Option<String>,
    pub country_name: Option<String>,
    pub semantic_url: Option<String>,
    pub tag: Option<String>,
    pub md5: Option<Vec<u8>>,
    pub sha256: Option<Vec<u8>>,
    pub sha256t: Option<Vec<u8>>,
    pub extra: Option<Value>,
}

The schema for each row.

This is just for documentation.
Optimized specifically for Postgres by using column tetris to save space.
The original schema is used as a base with reasonable changes made.

Added

Removed

Modified

Side notes

Postgres doesn't have a numeric smaller than i16 or unsigned integers.
For example: custom_spoiler should ideally be u8.


SQL table query

                                          Table "asagi.a"
     Column     |   Type   | Collation | Nullable | Default | Storage  | Stats target | Description
----------------+----------+-----------+----------+---------+----------+--------------+-------------
 no             | bigint   |           | not null |         | plain    |              |
 subnum         | bigint   |           |          |         | plain    |              |
 tim            | bigint   |           |          |         | plain    |              |
 resto          | bigint   |           | not null | 0       | plain    |              |
 time           | bigint   |           | not null | 0       | plain    |              |
 last_modified  | bigint   |           |          |         | plain    |              |
 archived_on    | bigint   |           |          |         | plain    |              |
 deleted_on     | bigint   |           |          |         | plain    |              |
 fsize          | integer  |           |          |         | plain    |              |
 w              | integer  |           |          |         | plain    |              |
 h              | integer  |           |          |         | plain    |              |
 replies        | integer  |           |          |         | plain    |              |
 images         | integer  |           |          |         | plain    |              |
 unique_ips     | integer  |           |          |         | plain    |              |
 tn_w           | smallint |           |          |         | plain    |              |
 tn_h           | smallint |           |          |         | plain    |              |
 custom_spoiler | smallint |           |          |         | plain    |              |
 since4pass     | smallint |           |          |         | plain    |              |
 sticky         | boolean  |           |          |         | plain    |              |
 closed         | boolean  |           |          |         | plain    |              |
 filedeleted    | boolean  |           |          |         | plain    |              |
 spoiler        | boolean  |           |          |         | plain    |              |
 m_img          | boolean  |           |          |         | plain    |              |
 bumplimit      | boolean  |           |          |         | plain    |              |
 imagelimit     | boolean  |           |          |         | plain    |              |
 name           | text     |           |          |         | extended |              |
 sub            | text     |           |          |         | extended |              |
 com            | text     |           |          |         | extended |              |
 filename       | text     |           |          |         | extended |              |
 ext            | text     |           |          |         | extended |              |
 trip           | text     |           |          |         | extended |              |
 id             | text     |           |          |         | extended |              |
 capcode        | text     |           |          |         | extended |              |
 country        | text     |           |          |         | extended |              |
 country_name   | text     |           |          |         | extended |              |
 semantic_url   | text     |           |          |         | extended |              |
 tag            | text     |           |          |         | extended |              |
 md5            | bytea    |           |          |         | extended |              |
 sha256         | bytea    |           |          |         | extended |              |
 sha256t        | bytea    |           |          |         | extended |              |
 extra          | jsonb    |           |          |         | extended |              |
Indexes:
    "unq_idx_no_subnum_a" UNIQUE, btree (no, COALESCE(subnum, 0::bigint))
    "idx_a_no_resto" btree (no, resto)
    "idx_a_time" btree (((floor(("time" / 86400)::double precision) * '86400'::double precision)::bigint))
    "trgm_idx_a_com" gin (com asagi.gin_trgm_ops)


The following below is taken from the official docs where applicable.

Fields

no: i64

Appears: always
Possible values: any positive integer
> The numeric post ID

subnum: Option<i64>

Appears: always if post is a ghost post
Possible values: any positive integer
> Used in FF for ghost posting

tim: Option<i64>

Appears: always if post has attachment
Possible values: integer
> Unix timestamp + microtime that an image was uploaded

resto: i64

Appears: always
Possible values: 0 or any positive integer
> For replies: this is the ID of the thread being replied to. For OP: this value is zero

time: i64

Appears: always
Possible values: UNIX timestamp
> UNIX timestamp the post was created

last_modified: i64

Appears: always
Possible values: UNIX timestamp
> UNIX timestamp the post had any of its fields modified

archived_on: Option<i64>

Appears: OP only, if thread has been archived
Possible values: UNIX timestamp
> UNIX timestamp the post was archived

deleted_on: Option<i64>

Appears: always if post has been deleted
Possible values: UNIX timestamp
> UNIX timestamp the post was deleted

fsize: Option<i32>

Appears: always if post has attachment
Possible values: any positive integer
> Size of uploaded file in bytes

w: Option<i32>

Appears: always if post has attachment
Possible values: any positive integer
> Image width dimension

h: Option<i32>

Appears: always if post has attachment
Possible values: any positive integer
> Image height dimension

replies: Option<i32>

Appears: OP only
Possible values: 0 or any positive integer
> Total number of replies to a thread

images: Option<i32>

Appears: OP only
Possible values: 0 or any positive integer
> Total number of image replies to a thread

unique_ips: Option<i32>

Appears: OP only, only if thread has NOT been archived
Possible values: any positive integer
> Number of unique posters in a thread

tn_w: Option<i16>

Appears: always if post has attachment
Possible values: any positive integer
> Thumbnail image width dimension

tn_h: Option<i16>

Appears: always if post has attachment
Possible values: any positive integer
> Thumbnail image height dimension

custom_spoiler: Option<i16>

Appears: if post has attachment and attachment is spoilered
Possible values: 1-10 or not set
> The custom spoiler ID for a spoilered image

since4pass: Option<i16>

Appears: if poster put 'since4pass' in the options field
Possible values: any 4 digit year
> Year 4chan pass bought

sticky: Option<bool>

Appears: OP only, if thread is currently stickied
Possible values: 1 or not set
> If the thread is being pinned to the top of the page

closed: Option<bool>

Appears: OP only, if thread is currently closed
Possible values: 1 or not set
> If the thread is closed to replies

filedeleted: Option<bool>

Appears: if post had attachment and attachment is deleted
Possible values: 1 or not set
> If the file was deleted from the post

spoiler: Option<bool>

Appears: if post has attachment and attachment is spoilered
Possible values: 1 or not set
> If the image was spoilered or not

m_img: Option<bool>

Appears: any post that has a mobile-optimized image
Possible values: 1 or not set
> Mobile optimized image exists for post

bumplimit: Option<bool>

Appears: OP only, only if bump limit has been reached
Possible values: 1 or not set
> If a thread has reached bumplimit, it will no longer bump

imagelimit: Option<bool>

Appears: OP only, only if image limit has been reached
Possible values: 1 or not set
> If an image has reached image limit, no more image replies can be made

name: Option<String>

Appears: always Note: Can be empty if user has a tripcode and opted out of a name
Possible values: any string
> Name user posted with. Defaults to Anonymous

sub: Option<String>

Appears: OP only, if subject was included
Possible values: any string
> OP Subject text

com: Option<String>

Appears: if comment was included
Possible values: any HTML escaped string
> Comment (HTML escaped)

filename: Option<String>

Appears: always if post has attachment
Possible values: any string
> Filename as it appeared on the poster's device

ext: Option<String>

Appears: always if post has attachment
Possible values: .jpg, .png, .gif, .pdf, .swf, .webm
> Filetype

trip: Option<String>

Appears: if post has tripcode
Possible values: any string
> The user's tripcode, in format: !tripcode or !!securetripcode

id: Option<String>

Appears: if post has ID
Possible values: any 8 characters
> The poster's ID

capcode: Option<String>

Appears: if post has capcode
Possible values: Not set, mod, admin, admin_highlight, manager, developer, founder
> The capcode identifier for a post

country: Option<String>

Appears: if country flags are enabled
Possible values: 2 character string or XX if unknown or troll_country if present > Poster's ISO 3166-1 alpha-2 country code

country_name: Option<String>

Appears: Name of any country
Possible values: any string
> Poster's country name

semantic_url: Option<String>

Appears: OP only
Possible values: string
> SEO URL slug for thread

tag: Option<String>

Appears: OP only, /f/ only
Possible values: Game, Loop, etc..
> The category of .swf upload

md5: Option<Vec<u8>>

Appears: always if post has attachment
Possible values:
> 24 character (base64), decoded binary MD5 hash of file

sha256: Option<Vec<u8>>

Appears: always if post has attachment
Possible values:
> 65 character (hex), binary SHA256 hash of file

sha256t: Option<Vec<u8>>

Appears: always if post has thumbnail attachment, excludes /f/
Possible values:
> 65 character (hex), binary SHA256 hash of thumbnail

extra: Option<Value>

Appears:
Possible values:
> Optional field for extra column additions

Trait Implementations

impl Clone for Post[src]

impl Debug for Post[src]

impl Default for Post[src]

impl<'de> Deserialize<'de> for Post where
    Post: Default
[src]

impl Serialize for Post[src]

Auto Trait Implementations

impl RefUnwindSafe for Post

impl Send for Post

impl Sync for Post

impl Unpin for Post

impl UnwindSafe for Post

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,