Config

Struct Config 

Source
pub struct Config { /* private fields */ }

Implementations§

Source§

impl Config

Source

pub fn new(db_type: ConfigDbType) -> Config

create a new config instance

Source

pub fn from_env_var(name: &str) -> Result<Config, Error>

create a new Config instance from an environment variable that contains a URL

Source

pub fn from_file_location<T: AsRef<Path>>(location: T) -> Result<Config, Error>

create a new Config instance from a config file located on the file system

Source

pub fn set_db_path(self, db_path: &str) -> Config

Source

pub fn set_trust_cert(&mut self)

Source

pub fn db_type(&self) -> ConfigDbType

Source

pub fn db_host(&self) -> Option<&str>

Source

pub fn db_port(&self) -> Option<&str>

Source

pub fn set_db_user(self, db_user: &str) -> Config

Source

pub fn set_db_pass(self, db_pass: &str) -> Config

Source

pub fn set_db_host(self, db_host: &str) -> Config

Source

pub fn set_db_port(self, db_port: &str) -> Config

Source

pub fn set_db_name(self, db_name: &str) -> Config

Trait Implementations§

Source§

impl AsyncMigrate for Config

Source§

fn get_last_applied_migration<'life0, 'life1, 'async_trait>( &'life0 mut self, migration_table_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Migration>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn get_applied_migrations<'life0, 'life1, 'async_trait>( &'life0 mut self, migration_table_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Migration>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn migrate<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, migrations: &'life1 [Migration], abort_divergent: bool, abort_missing: bool, grouped: bool, target: Target, migration_table_name: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Report, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn assert_migrations_table_query(migration_table_name: &str) -> String

Source§

fn get_last_applied_migration_query(migration_table_name: &str) -> String

Source§

fn get_applied_migrations_query(migration_table_name: &str) -> String

Source§

impl AsyncQuery<Vec<Migration>> for Config

Source§

fn query<'life0, 'life1, 'async_trait>( &'life0 mut self, _query: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Migration>, <Self as AsyncTransaction>::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl AsyncTransaction for Config

Source§

type Error = Infallible

Source§

fn execute<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, _queries: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Config

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl FromStr for Config

Source§

fn from_str(url_str: &str) -> Result<Config, Self::Err>

create a new Config instance from a string that contains a URL

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl Migrate for Config

Source§

fn get_last_applied_migration( &mut self, migration_table_name: &str, ) -> Result<Option<Migration>, Error>

Source§

fn get_applied_migrations( &mut self, migration_table_name: &str, ) -> Result<Vec<Migration>, Error>

Source§

fn migrate( &mut self, migrations: &[Migration], abort_divergent: bool, abort_missing: bool, grouped: bool, target: Target, migration_table_name: &str, ) -> Result<Report, Error>

Source§

fn assert_migrations_table_query(migration_table_name: &str) -> String

Source§

fn get_last_applied_migration_query(migration_table_name: &str) -> String

Source§

fn get_applied_migrations_query(migration_table_name: &str) -> String

Source§

fn assert_migrations_table( &mut self, migration_table_name: &str, ) -> Result<usize, Error>

Source§

fn get_unapplied_migrations( &mut self, migrations: &[Migration], abort_divergent: bool, abort_missing: bool, migration_table_name: &str, ) -> Result<Vec<Migration>, Error>

Source§

impl Query<Vec<Migration>> for Config

Source§

fn query(&mut self, _query: &str) -> Result<Vec<Migration>, Self::Error>

Source§

impl Serialize for Config

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Transaction for Config

Source§

type Error = Infallible

Source§

fn execute(&mut self, _queries: &[&str]) -> Result<usize, Self::Error>

Source§

impl TryFrom<&Config> for Config

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(config: &Config) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Url> for Config

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(url: Url) -> Result<Config, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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

Source§

impl<T> ErasedDestructor for T
where T: 'static,