use crate::{
datamodel_connector::{Connector, RelationMode},
Datasource, PreviewFeature,
};
use diagnostics::{DatamodelError, DatamodelWarning, Diagnostics};
use enumflags2::BitFlags;
pub(crate) struct Context<'a> {
pub(super) db: &'a parser_database::ParserDatabase,
pub(super) datasource: Option<&'a Datasource>,
pub(super) preview_features: BitFlags<PreviewFeature>,
pub(super) connector: &'static dyn Connector,
pub(super) relation_mode: RelationMode,
pub(super) diagnostics: &'a mut Diagnostics,
}
impl Context<'_> {
pub(super) fn push_error(&mut self, error: DatamodelError) {
self.diagnostics.push_error(error);
}
pub(super) fn push_warning(&mut self, warning: DatamodelWarning) {
self.diagnostics.push_warning(warning);
}
}