【发布时间】:2017-04-09 23:41:11
【问题描述】:
我正在尝试使用 Vapor 创建一个 Model,而在 prepare 方法中,我似乎无法弄清楚如何在语句中添加一些数据类型。
查看Vapor源码,似乎有一些数据类型可以存储:
extension Schema {
/**
Various types of fields
that can be used in a Schema.
*/
public struct Field {
public var name: String
public var type: DataType
public var optional: Bool
public enum DataType {
case id
case int
case string(length: Int?)
case double
case bool
case data
}
public init(name: String, type: DataType, optional: Bool = false) {
self.name = name
self.type = type
self.optional = optional
}
}
}
因此可以存储 Int、String (VARCHAR)、Double、Bool 和 Data (BLOB) 等数据类型,但我找不到我要查找的类型,具体来说:
- 未签名
SMALLINT(UInt16) DATETIME-
DECIMAL(The MySQL Decimal,不是 Double 或 Float)
我将如何制作这些?
【问题讨论】: