DatabaseController

class DatabaseController

Undocumented

  • Undocumented

    Declaration

    Swift

    static let realmTesting: Bool
  • Computes the Realm database path at /home//realm.memri/memri.realm and creates the directory (realm.memri) if it does not exist.

    Declaration

    Swift

    static func getRealmURL() throws -> URL

    Return Value

    the computed database file path

  • This function returns a Realm for the current thread

    Declaration

    Swift

    static func getRealmAsync(_ receiveRealm: @escaping (Error?, Realm?) -> Void)
  • This function returns a Realm for the current thread

    Declaration

    Swift

    static func getRealmSync() throws -> Realm
  • Execute a realm based function on the current thread

    Declaration

    Swift

    static func asyncOnCurrentThread(
        write: Bool = false,
        error: (@escaping (Error) -> Void) = globalErrorHandler,
        _ exec: @escaping (Realm) throws -> Void
    )
  • Execute a realm based function that returns a value on the main thread

    Declaration

    Swift

    static func sync<T>(
        write: Bool = false,
        _ exec: (Realm) throws -> T?
    ) -> T?
  • Execute a realm based function that throws and returns a value on the main thread

    Declaration

    Swift

    static func trySync<T>(
        write: Bool = false,
        _ exec: (Realm) throws -> T?
    ) throws -> T?
  • Execute a realm based function on a background thread

    Declaration

    Swift

    static func asyncOnBackgroundThread(
        write: Bool = false,
        error: (@escaping (Error) -> Void) = globalErrorHandler,
        _ exec: @escaping (Realm) throws -> Void
    )
  • Execute a realm based function on the main thread (warning this blocks the UI)

    Declaration

    Swift

    static func asyncOnMainThread(
        write: Bool = false,
        error: (@escaping (Error) -> Void) = globalErrorHandler,
        _ exec: @escaping (Realm) throws -> Void
    )
  • Undocumented

    Declaration

    Swift

    static func write(_ rlm: Realm?, _ exec: () throws -> Void)
  • Undocumented

    Declaration

    Swift

    static func globalErrorHandler(error: Error)
  • Undocumented

    Declaration

    Swift

    static func deleteDatabase(_ callback: @escaping (Error?) -> Void)
  • Undocumented

    Declaration

    Swift

    static func clean(_ callback: @escaping (Error?) -> Void)