Swiftpack.co - Package - 0xLeif/FLite

FLite

FluentSQLiteDriver --> F + Lite -- > FLite

Example Uses:

FLite.main

// Use FLite.main
//  Default Storage Type: Memory

try? FLite.prepare(migration: Todo.self).wait()

try! FLite.add(model: Todo(title: "Hello World", strings: ["hello", "world"])).wait()

FLite.fetch(model: Todo.self)
    .whenSuccess { (values) in
        print(values)
}

FLite.init(...)

// Create your own FLite

let flite = FLite(threads: 30,
                  configuration: .sqlite(.memory, maxConnectionsPerEventLoop: 30),
                  id: .sqlite,
                  logger: Logger(label: "Custom.FLITE"))

try? flite.prepare(migration: Todo.self).wait()

try! flite.add(model: Todo(title: "Hello World", strings: ["hello", "world"])).wait()

flite.fetch(model: Todo.self)
    .whenSuccess { (values) in
        print(values)
}

GitHub Supporters

suzyfendrick

Github

link
Stars: 3

Used By

Total: 0

Releases

Vapor 4 Support - 2020-09-01 20:52:05

Vapor 4 Release - 2020-07-15 19:54:08

Requires Xcode >= 11.5 and Swift 5.2

// Use FLite.main
//  Default Storage Type: Memory

try? FLite.prepare(migration: Todo.self).wait()

try! FLite.add(model: Todo(title: "Hello World", strings: ["hello", "world"])).wait()

FLite.fetch(model: Todo.self)
    .whenSuccess { (values) in
        print(values)
}

Vapor 3 Release - 2020-07-08 20:59:55

FLite.storage = .memory

FLite.prepare(model: Todo.self)
        
FLite.create(model: Todo(title: "Hello World"))

FLite.fetch(model: Todo.self) { values in
    print(values)
}