You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
vran d20a400931 feat: init core module 3 years ago
README feat: init core module 3 years ago
core feat: init core module 3 years ago
gradle/wrapper feat: init core module 3 years ago
.gitignore feat: databasir init 3 years ago
README.md feat: init core module 3 years ago
build.gradle feat: init core module 3 years ago
gradlew feat: init core module 3 years ago
gradlew.bat feat: init core module 3 years ago
settings.gradle feat: init core module 3 years ago

README.md

Databasir

Database document generator

you could use databasir to generate database meta model, or render it as markdown / pdf (TODO) / html (TODO)

How to use

Database Meta to Java Model

java.sql.Connection connection = ...;
DatabaseDocConfig config = DatabaseDocConfig.builder()
        .databaseName("Demo")
        .connection(connection)
        .build();
DatabaseDoc doc = JdbcDatabaseDocFactory.of().create(config).orElseThrow();

Render as Markdown

java.sql.Connection connection = ...;
DatabaseDocConfig config = DatabaseDocConfig.builder()
        .databaseName("Demo")
        .connection(connection)
        .build();
DatabaseDoc doc = JdbcDatabaseDocFactory.of().create(config).orElseThrow();
try (FileOutputStream out = new FileOutputStream("doc.md")) {
    RenderConfig renderConfig = new RenderConfig();
    Render.markdownRender(renderConfig).rendering(doc, out);
} catch (IOException e) {
    throw new IllegalStateException(e);
}
  • Example

Ignore tables or columns

support regex pattern to ignore table or column

java.sql.Connection connection = ...;
DatabaseDocConfig config = DatabaseDocConfig.builder()
        .databaseName("Demo")
        .connection(connection)
        .ignoreTableRegexes(Arrays.asList("mysql_*"))
        .ignoreColumnRegexes(Arrays.asList("id"))
        .build();
DatabaseDoc doc = JdbcDatabaseDocFactory.of().create(config).orElseThrow();

Extension

Default factory

  • tableDocFactory -> com.databasir.core.doc.factory.jdbc.JdbcTableDocFactory
  • columnDocFactory -> com.databasir.core.doc.factory.jdbc.JdbcTableColumnDocFactory
  • indexDocFactory -> com.databasir.core.doc.factory.jdbc.JdbcTableIndexDocFactory
  • triggerDocFactory -> com.databasir.core.doc.factory.jdbc.JdbcTableTriggerDocFactory

Custom configuration

java.sql.Connection connection = ...;
DatabaseDocConfig config = DatabaseDocConfig.builder()
        .databaseName("Demo")
        .connection(connection)
        .tableDocFactory(...) // your custom table doc factory
        .tableColumnDocFactory(...) // your custom column doc factory
        .tableIndexDocFactory(...) // your custom index doc factory
        .tableTriggerDocFactory(...) // your custom trigger doc factory
        .build();
DatabaseDoc doc = JdbcDatabaseDocFactory.of().create(config).orElseThrow();