Skip to content
Snippets Groups Projects
Commit 5def9931 authored by npedot's avatar npedot
Browse files

adds database mapping as table method

parent 9e47b371
Branches
Tags
No related merge requests found
......@@ -60,6 +60,19 @@ open class Database () {
return mappings().filter { m -> m.name.equals(name) }.firstOrNull()
}
fun mappingAsTable(name:String): Table? {
val mapping = mapping(name)
if (mapping==null) return null
val table = Table()
table.name = mapping.name
for(attribute in mapping.select.attributes.toSet()) {
val col = Column()
col.name = attribute.name
table.columns.add(col)
}
return table
}
@JsonIgnore
fun isEmpty(): Boolean {
return schema.tables().size == 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment