feophantlib/constants/
pg_error_levels.rs

1//! Constant error codes found from here: https://www.postgresql.org/docs/current/errcodes-appendix.html
2
3use bytes::Bytes;
4
5//https://stackoverflow.com/a/62759252/160208
6pub enum PgErrorLevels {
7    Error,
8    //Fatal,
9    //Panic,
10    //Warning,
11    //Notice,
12    //Debug,
13    //Info,
14    //Log
15}
16
17impl PgErrorLevels {
18    pub const fn value(self) -> Bytes {
19        use PgErrorLevels::*;
20        match self {
21            Error => Bytes::from_static(b"ERROR"),
22            //Fatal => Bytes::from_static(b"FATAL"),
23            //Panic => Bytes::from_static(b"PANIC"),
24            //Warning => Bytes::from_static(b"WARNING"),
25            //Notice => Bytes::from_static(b"NOTICE"),
26            //Debug => Bytes::from_static(b"DEBUG"),
27            //Info => Bytes::from_static(b"INFO"),
28            //Log => Bytes::from_static(b"LOG"),
29        }
30    }
31}