yamlbase/
lib.rs

1#![allow(clippy::uninlined_format_args)]
2
3pub mod config;
4pub mod database;
5pub mod protocol;
6pub mod server;
7pub mod sql;
8pub mod yaml;
9
10// Make test_utils available for integration tests
11#[cfg(any(test, feature = "test-utils"))]
12pub mod test_utils;
13
14pub use config::Config;
15pub use database::Database;
16pub use server::Server;
17
18#[derive(thiserror::Error, Debug)]
19pub enum YamlBaseError {
20    #[error("YAML parsing error: {0}")]
21    YamlParse(#[from] serde_yaml::Error),
22
23    #[error("SQL parsing error: {0}")]
24    SqlParse(#[from] sqlparser::parser::ParserError),
25
26    #[error("Database error: {message}")]
27    Database { message: String },
28
29    #[error("Protocol error: {0}")]
30    Protocol(String),
31
32    #[error("IO error: {0}")]
33    Io(#[from] std::io::Error),
34
35    #[error("Configuration error: {0}")]
36    Config(String),
37
38    #[error("Type conversion error: {0}")]
39    TypeConversion(String),
40
41    #[error("Not implemented: {0}")]
42    NotImplemented(String),
43}
44
45pub type Result<T> = std::result::Result<T, YamlBaseError>;