Class DataSourceService
java.lang.Object
io.micronaut.controlpanel.panels.datasource.DataSourceService
Service for a specific
DataSource, providing metadata about tables, columns, keys, etc.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordResult of executing a SQL query. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecuteQuery(String sql, int start, int length) Sanitize, execute and paginate a SQL query.generateMermaidER(List<Table> tables) Generate a Mermaid ER diagram for the current datasource based on the provided tables metadata.Retrieves a list of tables from the database, including schema, columns, primary keys, and foreign keys.
-
Constructor Details
-
DataSourceService
-
-
Method Details
-
getTables
-
generateMermaidER
Generate a Mermaid ER diagram for the current datasource based on the provided tables metadata. It includes entities with attributes (type, size, NOT NULL) and relationships based on foreign keys.- Parameters:
tables- Tables discovered bygetTables()- Returns:
- Mermaid ER diagram code
-
executeQuery
Sanitize, execute and paginate a SQL query.- Parameters:
sql- The SQL to executestart- Offset of the first rowlength- Maximum number of rows to return- Returns:
- QueryResult with column labels, rows and total row count
-