rustyroad 1.2.0

Rusty Road is a framework written in Rust that is based on Ruby on Rails. It is designed to provide the familiar conventions and ease of use of Ruby on Rails, while also taking advantage of the performance and efficiency of Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Placeholder-style selection for ledger statements.
//!
//! Postgres uses `$1`-style placeholders while MySQL and SQLite use `?`.

use crate::database::DatabaseConnection;

/// Selects the placeholder variant appropriate for `connection`.
pub(super) fn pick<'a>(
    connection: &DatabaseConnection,
    numbered: &'a str,
    positional: &'a str,
) -> &'a str {
    match connection {
        DatabaseConnection::Pg(_) => numbered,
        DatabaseConnection::MySql(_) | DatabaseConnection::Sqlite(_) => positional,
    }
}