java.lang.Object
org.nkjmlab.sorm4j.util.table_def.TableDefinition
This class represent a table schema. This class is a utility for users to define tables and
indexes. It should be noted that there is no guarantee that this object will match the table
definition in the database.
- 作成者:
- nkjm
-
ネストされたクラスの概要
ネストされたクラス -
メソッドの概要
修飾子とタイプメソッド説明static TableDefinition.Builderstatic TableDefinition.Builderstatic TableDefinition.BuilderCreates a newTableDefinition.Builderwith the given table name.dropTableIfExists(Orm orm) voidstatic Optional<Constructor<?>>getCanonicalConstructor(Class<?> recordClass) Gets create index if not exists statements.Returns aStringobject representing thisTableDefinition's value.Gets drop table if exists statement.Returns aStringobject representing thisTableDefinition's value.static StringtoSqlDataType(Class<?> type) toString()static StringtoTableName(Class<?> valueType)
-
メソッドの詳細
-
builder
Creates a newTableDefinition.Builderwith the given table name.- 戻り値:
-
builder
-
builder
-
toTableName
-
getCanonicalConstructor
-
toString
-
createIndexesIfNotExists
-
createTableIfNotExists
-
dropTableIfExists
-
dropTableIfExistsCascade
-
getColumnNames
-
getCreateIndexIfNotExistsStatements
Gets create index if not exists statements. Example.TableDefinition.builder("reports") .addColumnDefinition("id", VARCHAR, PRIMARY_KEY).addColumnDefinition("score", INT) .addIndexDefinition("score").addIndexDefinition("id", "score").build().getCreateIndexIfNotExistsStatements(); generates "[create index if not exists index_reports_score on reports(score), create index if not exists index_reports_id_score on reports(id, score)]"- 戻り値:
-
getCreateTableIfNotExistsStatement
Returns aStringobject representing thisTableDefinition's value.TableDefinition.builder("reports").addColumnDefinition("id", VARCHAR, PRIMARY_KEY) .addColumnDefinition("score", INT).build().getTableSchema(); generates "create table if not exists reports(id varchar primary key, score int)"- 戻り値:
-
getDropTableIfExistsStatement
Gets drop table if exists statement.- 戻り値:
-
getTableName
-
getTableNameAndColumnDefinitions
Returns aStringobject representing thisTableDefinition's value.TableDefinition.builder("reports").addColumnDefinition("id", VARCHAR, PRIMARY_KEY) .addColumnDefinition("score", INT).build().getTableSchema(); generates "reports(id varchar primary key, score int)"- 戻り値:
-
toSqlDataType
-