easy-rest-api 0.1.0

A simple library for creating a HTTP API with minimal setup.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::collections::HashMap;

use super::interfaces::SQLType;

#[derive(Debug)]
pub struct SqlTableSchema {
    pub name: String,

    // col name: data type
    pub fields: HashMap<String, SQLType>
}

impl SqlTableSchema {
    pub fn field_exists(&self, field_name: &str) -> bool {
        // id field is always present
        self.fields.contains_key(field_name) || field_name == "id"
    }
}