quick-oxibooks-sql 0.4.3

A library to construct type-checked and safe SQL queries for Oxibooks.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::fmt::Write;

#[derive(Debug, PartialEq, Clone, Copy)]
pub struct Limit {
    pub(crate) number: u32,
    pub(crate) offset: Option<u32>,
}

impl Limit {
    pub fn extend_query(&self, query: &mut String) {
        write!(query, " LIMIT {}", self.number).unwrap();
        if let Some(offset) = self.offset {
            write!(query, " OFFSET {offset}").unwrap();
        }
    }
}