codeint_lang_sql/
schema.rs1mod artifact;
2mod builder;
3mod codec;
4mod expr;
5mod rules;
6mod scope;
7#[cfg(test)]
8mod tests;
9mod types;
10
11use codeint_model::{FileScopeArtifact, LanguagePluginError, RepoPath, ScopeAnalysis};
12
13use crate::{ParsedSqlStatement, SqlDialect};
14
15pub use rules::{collect_schema_hazards, schema_hazard_rules};
16pub use types::{ColumnTypeClass, IndexSchema, SqlSchema, TableSchema};
17
18pub(crate) fn encode_file_artifact(
19 path: &RepoPath,
20 statements: &[ParsedSqlStatement],
21 dialect: SqlDialect,
22) -> Vec<u8> {
23 let is_down_migration = artifact::is_down_migration_path(path);
24 let ddl_ops = builder::extract_ddl_ops(statements, dialect);
25 let (scopes, checks) = rules::extract_scopes_and_checks(statements, dialect);
26 let file_artifact = artifact::SqlFileArtifact {
27 is_down_migration,
28 ddl_ops,
29 scopes,
30 checks,
31 };
32 codec::encode_artifact(&file_artifact)
33}
34
35pub(crate) fn analyze_scope_artifacts(
36 dialect: Option<&str>,
37 artifacts: Vec<FileScopeArtifact>,
38) -> Result<ScopeAnalysis, LanguagePluginError> {
39 artifact::analyze_scope_artifacts(dialect, artifacts)
40}