[][src]Trait ena::sql::Queries

pub trait Queries {
    fn query_init_schema(
        &self,
        schema: &str,
        engine: Database,
        charset: &str
    ) -> String;
fn query_init_metadata(&self, engine: Database, charset: &str) -> String;
fn query_init_board(
        &self,
        board: YotsubaBoard,
        engine: Database,
        charset: &str
    ) -> String;
fn query_init_type(&self) -> String;
fn query_init_views(&self, board: YotsubaBoard) -> String;
fn query_delete(&self, board: YotsubaBoard) -> String;
fn query_update_deleteds(
        &self,
        engine: Database,
        board: YotsubaBoard
    ) -> String;
fn query_update_hash(
        &self,
        board: YotsubaBoard,
        hash_type: YotsubaHash,
        media_mode: YotsubaStatement
    ) -> String;
fn query_update_metadata(&self, column: YotsubaEndpoint) -> String;
fn query_metadata(&self, column: YotsubaEndpoint) -> String;
fn query_medias(
        &self,
        board: YotsubaBoard,
        media_mode: YotsubaStatement
    ) -> String;
fn query_threads_modified(&self, endpoint: YotsubaEndpoint) -> String;
fn query_threads(&self) -> String;
fn query_threads_combined(
        &self,
        board: YotsubaBoard,
        endpoint: YotsubaEndpoint
    ) -> String;
fn query_update_thread(
        &self,
        engine: Database,
        board: YotsubaBoard
    ) -> String; }

SQL queries to use

Required methods

fn query_init_schema(
    &self,
    schema: &str,
    engine: Database,
    charset: &str
) -> String

Create the schema if nonexistent and uses it as the search_path

fn query_init_metadata(&self, engine: Database, charset: &str) -> String

Create the metadata if nonexistent to store the api endpoints' data

fn query_init_board(
    &self,
    board: YotsubaBoard,
    engine: Database,
    charset: &str
) -> String

Create a table for the specified board

fn query_init_type(&self) -> String

Create the 4chan schema as a type to be easily referenced

fn query_init_views(&self, board: YotsubaBoard) -> String

Create views for asagi

fn query_delete(&self, board: YotsubaBoard) -> String

Mark a post as deleted

fn query_update_deleteds(&self, engine: Database, board: YotsubaBoard) -> String

Compare between the thread in db and the one fetched and marks any posts missing in the fetched thread as deleted

fn query_update_hash(
    &self,
    board: YotsubaBoard,
    hash_type: YotsubaHash,
    media_mode: YotsubaStatement
) -> String

Upsert a media hash to a post

fn query_update_metadata(&self, column: YotsubaEndpoint) -> String

Upsert an endpoint to the metadata

JSON validity checks before upserting to metadata
Converts bytes to json object and feeds that into the query

fn query_metadata(&self, column: YotsubaEndpoint) -> String

Check for the existence of an endpoint in the metadata

fn query_medias(
    &self,
    board: YotsubaBoard,
    media_mode: YotsubaStatement
) -> String

Get a list of posts in a thread that have media

fn query_threads_modified(&self, endpoint: YotsubaEndpoint) -> String

Get ONLY the new/modified/deleted threads
Compare time modified and get the new threads
Get a list of only the deleted and modified threads when comparing the metadata and the fetched endpoint threads

fn query_threads(&self) -> String

Get a list of threads from the corresponding endpoint

fn query_threads_combined(
    &self,
    board: YotsubaBoard,
    endpoint: YotsubaEndpoint
) -> String

Get a combination of ALL threads from cache + new threads getting a total of 150+ threads
(excluding archived, deleted, and duplicate threads)
Get a list of threads from the one in the metadata + the fetched one

fn query_update_thread(&self, engine: Database, board: YotsubaBoard) -> String

Upsert a thread

This method updates an existing post or inserts a new one 1 2.
Posts are only updated where there's a field change.
A majority of posts in a thread don't change, this minimizes I/O writes.
(sha256, sha256t, and deleted are handled seperately as they are special cases)

4chan inserts a backslash in their md5.

Loading content...

Implementors

Loading content...