[][src]Struct dbq::SchemaConfig

pub struct SchemaConfig { /* fields omitted */ }

Configures the tables for storing the job queue and dead letters. The default SchemaConfig uses the default schema and prefixes the tables with dbq_

Examples

Default configuration

use dbq::*;
let config = SchemaConfig::default();
assert_eq!("dbq_job_queue", config.queue_table());
assert_eq!("dbq_job_dead_letters", config.dead_letters_table());

Change the table prefix

use dbq::*;
let config = SchemaConfig::new("my".to_string());
assert_eq!("my_job_queue", config.queue_table());
assert_eq!("my_job_dead_letters", config.dead_letters_table());

Remove the table prefix

use dbq::*;
let config = SchemaConfig::new("".to_string());
assert_eq!("job_queue", config.queue_table());
assert_eq!("job_dead_letters", config.dead_letters_table());

Use a custom schema

use dbq::*;
let mut config = SchemaConfig::new("".to_string());
config.set_schema(Some("jobs".to_string()));
assert_eq!("jobs.job_queue", config.queue_table());
assert_eq!("jobs.job_dead_letters", config.dead_letters_table());

Methods

impl SchemaConfig[src]

pub fn new(table_prefix: String) -> Self[src]

pub fn schema(&self) -> &Option<String>[src]

pub fn set_schema(&mut self, schema: Option<String>)[src]

pub fn table_prefix(&self) -> &str[src]

pub fn queue_table(&self) -> &str[src]

pub fn dead_letters_table(&self) -> &str[src]

Trait Implementations

impl Clone for SchemaConfig[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for SchemaConfig[src]

impl Debug for SchemaConfig[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Same for T

type Output = T

Should always be Self