KVStorageProtocol
public protocol KVStorageProtocol
A simple namespace-key-value storage protocol to stashing and retrieving Data
blobs.
-
set(ns:key:value:)
Default implementationSets the
Data
value for a key in a namespace.Default Implementation
Derived extension to set a
Numeric
value for a key in a namespace.Derived extension to set a
ToFromData
value for a key in a namespace.Declaration
Swift
func set(ns: CustomStringConvertible, key: CustomStringConvertible, value: Data)
-
get(ns:key:)
Default implementationGets the
Data
value for a key in a namespace.Default Implementation
Derived extension to get a
Numeric
value for a key in a namespace.Derived extension to get a
ToFromData
value for a key in a namespace.Declaration
Swift
func get(ns: CustomStringConvertible, key: CustomStringConvertible) -> Data?
-
Removes a key from a namespace.
Declaration
Swift
func remove(ns: CustomStringConvertible, key: CustomStringConvertible)
-
Tests whether a namespace has a key.
Declaration
Swift
func has(ns: CustomStringConvertible, key: CustomStringConvertible) -> Bool
-
Gets all keys in a namespace.
Declaration
Swift
func keys(ns: CustomStringConvertible) -> [String]
-
defaultNamespace
Extension methodThe
default namespace
we use to ergonomically stash a handful of global things.Declaration
Swift
var defaultNamespace: String { get }
-
set(_:_:)
Extension methodDerived method to set a
Data
value for a key in the default namespace.Declaration
Swift
func set(_ key: CustomStringConvertible, _ value: Data)
-
get(_:)
Extension methodDerived method to get a
Data
value for a key in the default namespace.Declaration
Swift
func get(_ key: CustomStringConvertible) -> Data?
-
remove(_:)
Extension methodDerived method to remove a key in the default namespace.
Declaration
Swift
func remove(_ key: CustomStringConvertible)
-
set(_:_:)
Extension methodDerived method to set a
Numeric
value for a key in the default namespace.Declaration
Swift
func set<T>(_ key: CustomStringConvertible, _ value: T) where T : Numeric
-
get(_:)
Extension methodDerived method to get a
Numeric
value for a key in the default namespace.Declaration
Swift
func get<T>(_ key: CustomStringConvertible) -> T? where T : Numeric
-
set(_:_:)
Extension methodDerived method to set a
ToFromData
value for a key in the default namespace.Declaration
Swift
func set<T>(_ key: CustomStringConvertible, _ value: T) where T : ToFromData
-
get(_:)
Extension methodDerived method to get a
ToFromData
value for a key in the default namespace.Declaration
Swift
func get<T>(_ key: CustomStringConvertible) -> T? where T : ToFromData