ViewDefinition
public struct ViewDefinition
Structure used in PredixMobilityConfiguration to define a database View. See dataViewDefinitions and appendDataViewDefinition
-
Name of the view
Declaration
Swift
public var viewName: String -
Version of the view
Declaration
Swift
public var version: String -
Closure that will be called when the view indexes.
Declaration
Swift
public var mapFunction : (_ properties: [String : Any], _ emit: @escaping (Any, Any?)->Void)->VoidParameters
propertiesThe document being indexed.
emitclosure to be called if this document should be indexed by this view. The first parameter of this closure is the index key. The second parameter of the closure will be the value. Values are optional.
-
If provided, the reduce closure will be called when the view is queried to summarize the results of a view.
Declaration
Swift
public var reduceFunction: ((_ keys: [Any], _ values: [Any], _ re: Bool) -> (Any))?Parameters
keysAn array of keys to be reduced (or nil if this is a rereduce)
valuesA parallel array of values to be reduced, corresponding 1::1 with the keys.
rerereduce, true if the input values are the results of previous reductions.
Return Value
The reduced value; almost always a scalar or small fixed-size object.
-
initialization
Declaration
Swift
public init(viewName: String, version: String, mapFunction: @escaping (_ properties: [String : Any], _ emit: (Any, Any?)->Void)->Void)
View on GitHub
ViewDefinition Structure Reference