Class CreateTableBuilder
java.lang.Object
io.github.projectunified.craftdatabase.client.sql.helper.CreateTableBuilder
A builder for
CREATE TABLE queries-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the queryAdd a columnconstraint(String constraint) Add a table constraintstatic CreateTableBuilderCreate a new builderAdd theIF NOT EXISTSoption
-
Method Details
-
create
Create a new builder- Parameters:
table- the table- Returns:
- the builder
-
ifNotExists
Add theIF NOT EXISTSoption- Returns:
- this builder for chaining
-
column
Add a column- Parameters:
name- the column namedefinition- the column definition, e.g."INT PRIMARY KEY"or"VARCHAR(100) NOT NULL"- Returns:
- this builder for chaining
-
constraint
Add a table constraint- Parameters:
constraint- the constraint, e.g."PRIMARY KEY (a, b)"- Returns:
- this builder for chaining
-
build
Build the query- Returns:
- the query
-