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