43 lines
1.7 KiB
C#
43 lines
1.7 KiB
C#
using Strata.SqlTools.SqlBreakdown.Classes;
|
|
|
|
namespace Strata.SqlTools.Markdown.Snowflake;
|
|
|
|
/// <summary>
|
|
/// Generates Mermaid diagrams for Snowflake SQL statements, including sequence diagrams
|
|
/// for statement execution flow and entity-relationship diagrams.
|
|
/// </summary>
|
|
public class SqlStatementGenerator
|
|
{
|
|
private readonly SqlServer.SqlStatementGenerator _baseGenerator;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the SqlStatementGenerator class.
|
|
/// </summary>
|
|
public SqlStatementGenerator()
|
|
{
|
|
_baseGenerator = new SqlServer.SqlStatementGenerator();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Generates a Mermaid sequence diagram showing Snowflake SQL statement execution flow.
|
|
/// </summary>
|
|
/// <param name="sqlBreakdown">The Snowflake SQL breakdown object.</param>
|
|
/// <param name="title">Optional title for the diagram.</param>
|
|
/// <returns>A string containing the Mermaid sequence diagram markdown.</returns>
|
|
public string GenerateSequenceDiagram(SqlBreakdownBase sqlBreakdown, string? title = null)
|
|
{
|
|
return _baseGenerator.GenerateSequenceDiagram(sqlBreakdown, title);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Generates a Mermaid entity-relationship diagram from table names.
|
|
/// </summary>
|
|
/// <param name="tables">Collection of table names to include in the diagram.</param>
|
|
/// <param name="title">Optional title for the diagram.</param>
|
|
/// <returns>A string containing the Mermaid ER diagram markdown.</returns>
|
|
public string GenerateEntityRelationshipDiagram(IEnumerable<string> tables, string? title = null)
|
|
{
|
|
return _baseGenerator.GenerateEntityRelationshipDiagram(tables, title);
|
|
}
|
|
}
|