Skip to content

Latest commit

 

History

History
24 lines (21 loc) · 726 Bytes

StORMLifecycleEvents.md

File metadata and controls

24 lines (21 loc) · 726 Bytes

StORM Global Lifecycle Events

modifyValue

/* Signature: */ open func modifyValue(_: Any, forKey: String) -> Any

This event is fired during calls to asData(_:) and asDataDict(_:) to allow custom encoding of the data used.

Example:

override func modifyValue(_ v: Any, forKey k: String) -> Any {
    if let d = v as? Date {
        return d.timestamptz
    }
    return v
}

This will convert all Dates to Strings formatted as PostgreSQL's timestamp with timezone type. (The implementation of timestamptz is irrelevant other than it returns a String)