OSRecord
public class OSRecord : Equatable, Hashable
OSRecord
is an object representing a row in your database. It can be modified to keep certain properties or hide data. It’s a pretty light object that helps OrionSearch unifying its ecosystem architecture without using native objects for better integration across all the different platforms.
The OSRecord
object will mostly be used as a read-only property given by the perform
method in OrionSearch
. But it can also be created manually for in-memory databases:
let record = OSRecord(data: [ ... ]) // creates the record
Accessing the data
OSRecord
has a simple data
property to access the data originally given.
record.data["myproperty"]
-
==
Operator forOSRecord
Declaration
Swift
public static func == (lhs: OSRecord, rhs: OSRecord) -> Bool
Parameters
lhs
Left record
rhs
Right record
Return Value
Bool
-
Declaration
Swift
public func hash(into hasher: inout Hasher)
-
record’s data
Declaration
Swift
public var data: [String : Any]
-
Record’s score. Used for sorting.
Declaration
Swift
public var score: Double
-
The initializer manages the record’s data
Declaration
Swift
public init(data: [String : Any])
Parameters
data
Takes a dictionnary as input, represent the record’s data
-
Record’s main value
Declaration
Swift
public var main: String?
-
Set record’s main property
Declaration
Swift
public func main(key: String)
Parameters
key
The key that will act as main key
-
Record’s secondary value
Declaration
Swift
public var secondary: String?
-
Set record’s main property
Declaration
Swift
public func secondary(key: String)
Parameters
key
The key that will act as secondary key
-
Keys of the data object
Declaration
Swift
public var keys: [String] { get }
-
Values of the data object
Declaration
Swift
public var values: [Any] { get }