-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataSchema.scala
51 lines (44 loc) · 1.06 KB
/
DataSchema.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package dbcodegen
import schemacrawler.schema.{Column, Index, Schema, Table, View}
case class DataColumn(
name: String,
scalaType: String,
db: Column,
) {
def scalaName = NameFormat.sanitizeScalaName(NameFormat.toCamelCase(name))
}
case class DataIndex(
name: String,
columns: Seq[DataColumn],
db: Index,
) {
def scalaName = NameFormat.sanitizeScalaName(NameFormat.toPascalCase(name))
}
case class DataTable(
name: String,
columns: Seq[DataColumn],
indices: Seq[DataIndex],
db: Table,
) {
def isView: Boolean = db.isInstanceOf[View]
def scalaName = NameFormat.sanitizeScalaName(NameFormat.toPascalCase(name))
}
case class DataEnumValue(
name: String
) {
def scalaName = NameFormat.sanitizeScalaName(name)
}
case class DataEnum(
name: String,
values: Seq[DataEnumValue],
) {
def scalaName = NameFormat.sanitizeScalaName(NameFormat.toPascalCase(name))
}
case class DataSchema(
name: String,
tables: Seq[DataTable],
enums: Seq[DataEnum],
db: Schema,
) {
def scalaName = NameFormat.sanitizeScalaName(NameFormat.toCamelCase(name))
}