0
錯誤參數標籤'(content :)'不匹配任何可用的重載。使用postgresql時,其餘部分蒸汽以獲取模式控制器JSON representable.The語法如下其次,在數據庫意爲內容參數標籤'(content :)'不匹配任何可用的重載,快速,蒸氣,靜止在蒸氣中,使用postgresql
import Foundation
import Vapor
import FluentProvider
import PostgreSQLProvider
final class dataPointStorage: Model, JSONRepresentable, NodeRepresentable {
// var _data: dataPointProtocol?
// var _data:[dataPointProtocol] = []
let storage = Storage()
var id: Node?
var name:String
var displayName:String
var content:String
// let temp = dataPointStorage()
init(node:Node ,content: String?, displayName:String, name:String) {
self.id = nil
self.displayName = displayName
self.name = name
}
static let idKey = "id"
static let contentKey = "content"
func forDataBase() {
let array:[berichtDataPoint] = [intDataPoint(), boolDataPoint(), doubleDataPoint()]
let _ = array[0] as! intDataPoint
let _ = array[1] as! doubleDataPoint
for point in array {
switch point {
case is intDataPoint:
print("int")
case is doubleDataPoint:
print("double")
case is boolDataPoint:
print("bool")
default:
print("error")
}
}
}
func makeRow() throws -> Row {
var row = Row()
try row.set("id", id)
try row.set("displayName", displayName)
try row.set("name", name)
return row
}
init(row: Row) throws {
id = try row.get("id")
displayName = try row.get("displayName")
name = try row.get("name")
}
func makeNode(context: Context) throws -> Node {
return try Node(node: [
"id": id,
"displayName": displayName,
"name": name
])
}
}
extension dataPointStorage: Preparation {
static func prepare(_ database: Database) throws {
try database.create(self) { dataPointStorage in
dataPointStorage.id()
dataPointStorage.string("displayName")
dataPointStorage.string("name")
dataPointStorage.string("content")
}
}
static func revert(_ database: Database) throws {
try database.delete(dataPointStorage)
}
}
extension dataPointStorage: JSONConvertible {
convenience init(json: JSON) throws {
try self.init(
error here¶¶¶ content: json.get(dataPointStorage.contentKey)¶¶¶¶ error
)
}
func makeJSON() throws -> JSON {
var json = JSON()
try json.set("id", id)
try json.set("name", name)
try json.set("displaName", displayName)
try json.set("content", Content)
return json
}
}
我下面休息的蒸汽一般上下文JSON表示的,但沒有得到這個簡單的理由錯誤來解決。