[英]Additional Data types (such as Unsigned SmallInt, Datetime and Decimal) in Swift Vapor/Fluent Model?
我正在嘗試用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
( MySQL十進制 ,不是Double或Float) 我怎么做這些?
目前,Vapor / Fluent中沒有該功能,但它正在制作中 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.