Struct rustorm::platform::postgres::Postgres [] [src]

pub struct Postgres {
    pub pool: Option<PooledConnection<PostgresConnectionManager>>,
}

Fields

pool

a connection pool is provided

Methods

impl Postgres

Build the Query into a SQL statements that is a valid PostgreSQL sql query, TODO: support version SqlOptions/specific syntax

fn new() -> Self

create an instance, but without a connection yet, useful when just building sql queries specific to this platform inexpensive operation, so can have multiple instances

fn with_pooled_connection(pool: PooledConnection<PostgresConnectionManager>) -> Self

fn get_connection(&self) -> &Connection

Trait Implementations

impl Database for Postgres

fn version(&self) -> String

fn begin(&self)

fn commit(&self)

fn rollback(&self)

fn is_transacted(&self) -> bool

fn is_closed(&self) -> bool

fn is_connected(&self) -> bool

fn close(&self)

fn is_valid(&self) -> bool

fn reset(&self)

fn sql_options(&self) -> Vec<SqlOption>

fn update(&self, _query: &Query) -> Dao

fn delete(&self, _query: &Query) -> Result<usize, String>

fn execute_sql_with_return(&self, sql: &str, params: &Vec<Value>) -> Result<Vec<Dao>, DbError>

fn execute_sql(&self, sql: &str, params: &Vec<Value>) -> Result<usize, DbError>

fn select(&self, query: &Query) -> Result<DaoResult, DbError>

fn insert(&self, query: &Query) -> Result<Dao, DbError>

fn execute_with_return(&self, query: &Query) -> Result<DaoResult, DbError>

fn execute_with_one_return(&self, query: &Query) -> Result<Dao, DbError>

fn execute(&self, query: &Query) -> Result<usize, DbError>

fn execute_sql_with_one_return(&self, sql: &str, params: &Vec<Value>) -> Result<Dao, DbError>

fn build_query(&self, query: &Query) -> SqlFrag

fn build_operand(&self, w: &mut SqlFrag, parent_query: &Query, operand: &Operand)

fn build_condition(&self, w: &mut SqlFrag, parent_query: &Query, cond: &Condition)

fn build_field(&self, w: &mut SqlFrag, parent_query: &Query, field: &Field)

fn build_filter(&self, w: &mut SqlFrag, parent_query: &Query, filter: &Filter)

fn build_filters(&self, w: &mut SqlFrag, parent_query: &Query, filters: &Vec<Filter>)

fn build_enumerated_fields(&self, w: &mut SqlFrag, parent_query: &Query, enumerated_fields: &Vec<Field>)

fn build_select(&self, query: &Query) -> SqlFrag

fn build_insert(&self, query: &Query) -> SqlFrag

fn build_update(&self, query: &Query) -> SqlFrag

fn build_delete(&self, query: &Query) -> SqlFrag

impl DatabaseDDL for Postgres

fn create_schema(&self, _schema: &str)

fn drop_schema(&self, _schema: &str)

fn create_table(&self, _model: &Table)

fn build_create_table(&self, _table: &Table) -> SqlFrag

fn rename_table(&self, _table: &Table, _new_tablename: String)

fn drop_table(&self, _table: &Table)

fn set_foreign_constraint(&self, _model: &Table)

fn set_primary_constraint(&self, _model: &Table)

impl DatabaseDev for Postgres

this can be condensed with using just extracting the table definition

fn get_parent_table(&self, schema: &str, table: &str) -> Option<String>

fn get_table_sub_class(&self, schema: &str, table: &str) -> Vec<String>

fn get_table_metadata(&self, schema: &str, table: &str, is_view: bool) -> Table

fn get_all_tables(&self) -> Vec<(String, String, bool)>

fn get_inherited_columns(&self, schema: &str, table: &str) -> Vec<String>

fn dbtype_to_rust_type(&self, db_type: &str) -> (Vec<String>, String)

fn rust_type_to_dbtype(&self, rust_type: &str) -> String