pub struct PgSchema { /* private fields */ }
Expand description
A struct representing a PostgreSQL schema.
Implementations§
Source§impl PgSchema
impl PgSchema
Sourcepub fn enums(&self) -> String
pub fn enums(&self) -> String
Generates a SQL statement for creating all enum types in the schema.
Sourcepub fn types(&self) -> String
pub fn types(&self) -> String
Generates a SQL statement for creating all composite types in the schema.
Sourcepub fn tables(&self) -> String
pub fn tables(&self) -> String
Generates a SQL statement for creating all tables in the schema.
Sourcepub fn mviews(&self) -> String
pub fn mviews(&self) -> String
Generates a SQL statement for creating all materialized views in the schema.
Sourcepub fn functions(&self) -> String
pub fn functions(&self) -> String
Generates a SQL statement for creating all functions in the schema.
Source§impl PgSchema
impl PgSchema
Sourcepub async fn get_enums(&self, pool: &PgPool) -> Result<Vec<String>, Error>
Available on crate feature db-postgres
only.
pub async fn get_enums(&self, pool: &PgPool) -> Result<Vec<String>, Error>
db-postgres
only.Async function that fetches the SQL statements for $name for the specified schema item.
Example usage:
use crate::PgSchema;
let schema = PgSchema::new("my_schema");
let pool = get_pg_pool(); // Function to get a connection pool
let sqls = schema.[<get_ $name>](&pool).await.unwrap();
Sourcepub async fn get_types(&self, pool: &PgPool) -> Result<Vec<String>, Error>
Available on crate feature db-postgres
only.
pub async fn get_types(&self, pool: &PgPool) -> Result<Vec<String>, Error>
db-postgres
only.Async function that fetches the SQL statements for $name for the specified schema item.
Example usage:
use crate::PgSchema;
let schema = PgSchema::new("my_schema");
let pool = get_pg_pool(); // Function to get a connection pool
let sqls = schema.[<get_ $name>](&pool).await.unwrap();
Sourcepub async fn get_tables(&self, pool: &PgPool) -> Result<Vec<String>, Error>
Available on crate feature db-postgres
only.
pub async fn get_tables(&self, pool: &PgPool) -> Result<Vec<String>, Error>
db-postgres
only.Async function that fetches the SQL statements for $name for the specified schema item.
Example usage:
use crate::PgSchema;
let schema = PgSchema::new("my_schema");
let pool = get_pg_pool(); // Function to get a connection pool
let sqls = schema.[<get_ $name>](&pool).await.unwrap();
Sourcepub async fn get_views(&self, pool: &PgPool) -> Result<Vec<String>, Error>
Available on crate feature db-postgres
only.
pub async fn get_views(&self, pool: &PgPool) -> Result<Vec<String>, Error>
db-postgres
only.Async function that fetches the SQL statements for $name for the specified schema item.
Example usage:
use crate::PgSchema;
let schema = PgSchema::new("my_schema");
let pool = get_pg_pool(); // Function to get a connection pool
let sqls = schema.[<get_ $name>](&pool).await.unwrap();
Sourcepub async fn get_mviews(&self, pool: &PgPool) -> Result<Vec<String>, Error>
Available on crate feature db-postgres
only.
pub async fn get_mviews(&self, pool: &PgPool) -> Result<Vec<String>, Error>
db-postgres
only.Async function that fetches the SQL statements for $name for the specified schema item.
Example usage:
use crate::PgSchema;
let schema = PgSchema::new("my_schema");
let pool = get_pg_pool(); // Function to get a connection pool
let sqls = schema.[<get_ $name>](&pool).await.unwrap();
Sourcepub async fn get_functions(&self, pool: &PgPool) -> Result<Vec<String>, Error>
Available on crate feature db-postgres
only.
pub async fn get_functions(&self, pool: &PgPool) -> Result<Vec<String>, Error>
db-postgres
only.Async function that fetches the SQL statements for $name for the specified schema item.
Example usage:
use crate::PgSchema;
let schema = PgSchema::new("my_schema");
let pool = get_pg_pool(); // Function to get a connection pool
let sqls = schema.[<get_ $name>](&pool).await.unwrap();
Sourcepub async fn get_triggers(&self, pool: &PgPool) -> Result<Vec<String>, Error>
Available on crate feature db-postgres
only.
pub async fn get_triggers(&self, pool: &PgPool) -> Result<Vec<String>, Error>
db-postgres
only.Async function that fetches the SQL statements for $name for the specified schema item.
Example usage:
use crate::PgSchema;
let schema = PgSchema::new("my_schema");
let pool = get_pg_pool(); // Function to get a connection pool
let sqls = schema.[<get_ $name>](&pool).await.unwrap();
Sourcepub async fn get_indexes(&self, pool: &PgPool) -> Result<Vec<String>, Error>
Available on crate feature db-postgres
only.
pub async fn get_indexes(&self, pool: &PgPool) -> Result<Vec<String>, Error>
db-postgres
only.Async function that fetches the SQL statements for $name for the specified schema item.
Example usage:
use crate::PgSchema;
let schema = PgSchema::new("my_schema");
let pool = get_pg_pool(); // Function to get a connection pool
let sqls = schema.[<get_ $name>](&pool).await.unwrap();
Trait Implementations§
Source§impl Ord for PgSchema
impl Ord for PgSchema
Source§impl PartialOrd for PgSchema
impl PartialOrd for PgSchema
impl Eq for PgSchema
impl StructuralPartialEq for PgSchema
Auto Trait Implementations§
impl Freeze for PgSchema
impl RefUnwindSafe for PgSchema
impl Send for PgSchema
impl Sync for PgSchema
impl Unpin for PgSchema
impl UnwindSafe for PgSchema
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more