CocoaPods trunk is moving to be read-only. Read more on the blog, there are 3 months to go.

swift.db 0.1.5

swift.db 0.1.5

Maintained by Podul-verbose.



swift.db 0.1.5

  • By
  • Podul

swift.db

CI Status Version License Platform

Requirements

  • iOS 10.0+
  • Xcode 10.2+
  • Swift 5+

Installation

CocoaPods

pod 'swift.db '~> '0.1.4'

Swift Package Manager

0.1.4 开始支持 Swift Package Manager

dependencies: [
    .package(url: "https://github.com/podul/swift.db", from: "0.1.4")
]

使用方法

  1. 需要创建遵守DataBaseModel协议的模型,你可以使用一些基础类型(e.g.Int String Float),也可以使用Text Integer等数据库支持的类型。
struct Model: DataBaseModel {
    var id: Primary = 0
    var name: String = "name"
    var text: Text? = "text"
    ...
}
  1. 创建并打开数据库
DB.Manager.open(db: "dbname.sqlite3", create: Model.self)
  1. 数据库操作
DB.Manager.insert(model)
DB.Manager.delete(model)
DB.Manager.update(model)
DB.Manager.query(model)
...

Author

Podul, [email protected]

License

swift.db is available under the MIT license. See the LICENSE file for more info.