pub trait PsqlInitResource
where Self: Resource + Clone,
{ // Required method fn _get_create_table_query() -> String; // Provided methods fn _init_table_indices<'async_trait>( ) -> Pin<Box<dyn Future<Output = Result<(), ArrErr>> + Send + 'async_trait>> where Self: Send + 'async_trait { ... } fn init_table<'async_trait>( ) -> Pin<Box<dyn Future<Output = Result<(), ArrErr>> + Send + 'async_trait>> where Self: Send + 'async_trait { ... } fn drop_table<'async_trait>( ) -> Pin<Box<dyn Future<Output = Result<(), ArrErr>> + Send + 'async_trait>> where Self: Send + 'async_trait { ... } }
Expand description

Generic PostgreSQL trait to provide table init functions for Resource struct

Required Methods§

source

fn _get_create_table_query() -> String

Internal function to get the query that should be used to create the resource’s table. Should be overwritten by the implementor.

Provided Methods§

source

fn _init_table_indices<'async_trait>( ) -> Pin<Box<dyn Future<Output = Result<(), ArrErr>> + Send + 'async_trait>>
where Self: Send + 'async_trait,

Internal function called by init_table to run table index creation queries if any indices are defined for the resource

source

fn init_table<'async_trait>( ) -> Pin<Box<dyn Future<Output = Result<(), ArrErr>> + Send + 'async_trait>>
where Self: Send + 'async_trait,

Create table with specified columns using the resource’s psql_definition

source

fn drop_table<'async_trait>( ) -> Pin<Box<dyn Future<Output = Result<(), ArrErr>> + Send + 'async_trait>>
where Self: Send + 'async_trait,

Drops the entire table for the resource

Object Safety§

This trait is not object safe.

Implementors§