rest-sql 0.3.0

RSQL/FIQL filter parser and validator for REST APIs — parse, validate, compile to native DB queries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/// Transforms a logical field name to its storage representation.
/// Implement this in drivers to handle JSONB paths, column aliases, etc.
pub trait FieldMapper {
    fn map<'a>(&self, field: &'a str) -> std::borrow::Cow<'a, str>;
}

/// Identity mapper — field name is used as-is.
#[derive(Debug, Clone, Default)]
pub struct IdentityMapper;

impl FieldMapper for IdentityMapper {
    fn map<'a>(&self, field: &'a str) -> std::borrow::Cow<'a, str> {
        std::borrow::Cow::Borrowed(field)
    }
}