storage
The internal storage.
var storage: [String : Any]
The internal storage.
var storage: [String : Any]
import Vapor
Vapor is a framework for building server applications, APIs and websites in Swift. It provides a safe, performant and scalable foundation for building large complex backends.
struct Extend
A wrapper around a simple [String: Any] storage dictionary used to implement Extendable
.
@frozen struct String
A Unicode string value that is a collection of characters.
init()
Create a new extend.
init(dictionaryLiteral elements: (String, Any)...)
See ExpressibleByDictionaryLiteral
.
init(from decoder: Decoder) throws
See Codable
.
subscript(key: String) -> Any? { get set }
Allow subscripting by String
key. This is a type-erased alternative to the get(_:default:)
and set(:to:)
methods.
func encode(to encoder: Encoder) throws
See Codable
.
func get<T>(_ key: String, default d: T) -> T
Gets a value from the Extend
storage falling back to the default value if it does not exist or cannot be casted to T
.
func get<T>(_ key: AnyKeyPath, default d: T) -> T
Gets a value from the Extend
storage falling back to the default value if it does not exist or cannot be casted to T
.
mutating func set<T>(_ key: String, to newValue: T)
Set a value to the Extend
storage.
mutating func set<T>(_ key: AnyKeyPath, to newValue: T)
Set a value to the Extend
storage.