- Kotlin Blueprints
- Ashish Belagali Hardik Trivedi Akshay Chordiya
- 106字
- 2021-07-02 21:50:14
Defining the table
To define a table you need to create an object with the required fields and extend the Table class and Exposed will create the table in the database for you with the fields as columns:
object Messages: Table() { val id = integer("id").autoIncrement().primaryKey() val name = varchar("name", 100) }
It will result in the following query called by Exposed:
CREATE TABLE IF NOT EXISTS Messages (id INT AUTO_INCREMENT NOT
NULL, name VARCHAR(100) NOT NULL, CONSTRAINT pk_Messages PRIMARY
KEY (id))
Currently Exposed doesn't have support for data classes and the repository pattern. It requires the creation of an object of the required structure.
推薦閱讀
- Spring 5.0 Microservices(Second Edition)
- Java多線程編程實戰指南:設計模式篇(第2版)
- What's New in TensorFlow 2.0
- C語言程序設計(第2 版)
- Getting Started with CreateJS
- C#程序設計教程
- 基于Swift語言的iOS App 商業實戰教程
- 大學計算機基礎實驗指導
- Python機器學習算法: 原理、實現與案例
- C++寶典
- C++ Application Development with Code:Blocks
- Mockito Essentials
- 算法圖解
- 大數據時代的企業升級之道(全3冊)
- Mastering OAuth 2.0