Added .toString() shortcut and some reflection

This commit is contained in:
Andrew Golovashevich 2025-03-24 03:09:33 +03:00
parent 20f73d4dfa
commit f826cf25f9
4 changed files with 11 additions and 5 deletions

View File

@ -1,9 +1,12 @@
package ru.landgrafhomyak.db.serdha0.api.misc package ru.landgrafhomyak.db.raw_sql_skeleton
public class Column( public class Column(
public val table: Table,
public val name: String, public val name: String,
public val referenceType: String, public val referenceType: String,
public val declarationType: String public val declarationType: String
) { ) {
public constructor(name: String, type: String) : this(name, type, type) public constructor(table: Table, name: String, type: String) : this(table, name, type, type)
override fun toString(): String = this.name
} }

View File

@ -18,7 +18,7 @@ public class Namespace(
throw IllegalArgumentException("Name is already used: $name") throw IllegalArgumentException("Name is already used: $name")
this.usedNames.add(name) this.usedNames.add(name)
return Table(this.formatTableName(name), this._path + this._name) return Table(this, this.formatTableName(name))
} }
public val _path: List<String> = this.path.asList() public val _path: List<String> = this.path.asList()

View File

@ -1,7 +1,11 @@
package ru.landgrafhomyak.db.raw_sql_skeleton package ru.landgrafhomyak.db.raw_sql_skeleton
public class Table(public val name: String, public val namespacesFromModuleRoot: List<String>) { public class Table(
public val namespace: Namespace,
public val name: String
) {
public val asSqlReference: String = "\"${this.name}\"" public val asSqlReference: String = "\"${this.name}\""
public val asSqlString: String = "\'${this.name}\'" public val asSqlString: String = "\'${this.name}\'"
override fun toString(): String = this.asSqlReference override fun toString(): String = this.asSqlReference
} }

View File

@ -1,6 +1,5 @@
package ru.landgrafhomyak.db.raw_sql_skeleton package ru.landgrafhomyak.db.raw_sql_skeleton
import ru.landgrafhomyak.db.serdha0.api.misc.Column
import ru.landgrafhomyak.db.serdha0.api.table.Index import ru.landgrafhomyak.db.serdha0.api.table.Index
import ru.landgrafhomyak.db.serdha0.api.table.UniqueIndex import ru.landgrafhomyak.db.serdha0.api.table.UniqueIndex