Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dbef421

Browse files
committed
Kotlin: Generate dbscheme deterministically
1 parent afea187 commit dbef421

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

java/kotlin-extractor/generate_dbscheme.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def upperFirst(string):
4242
s = type_hierarchy.get(typ, set())
4343
s.add(name)
4444
type_hierarchy[typ] = s
45-
kt.write('\n')
4645

4746
# tables
4847
for relname, body in re.findall('\n([\w_]+)(\([^)]*\))',
@@ -84,11 +83,11 @@ def upperFirst(string):
8483
kt.write(')\\n")\n')
8584
kt.write('}\n')
8685

87-
for typ in type_hierarchy:
86+
for typ in sorted(type_hierarchy):
8887
kt.write('sealed interface Db' + upperFirst(typ))
89-
names = type_hierarchy[typ]
88+
names = sorted(type_hierarchy[typ])
9089
if names:
9190
kt.write(': ')
92-
kt.write(', '.join(map(lambda name: 'Db' + upperFirst(name), type_hierarchy[typ])))
91+
kt.write(', '.join(map(lambda name: 'Db' + upperFirst(name), names)))
9392
kt.write(' {}\n')
9493

0 commit comments

Comments
 (0)