![GRDB: A toolkit for SQLite databases, with a focus on application development](https://raw.githubusercontent.com/groue/GRDB.swift/master/GRDB.png)
<p align="center"><strong>A toolkit for SQLite databases, with a focus on application development</strong></p>
<p align="center">
<a href="https://developer.apple.com/swift/"><img alt="Swift 5.2" src="https://img.shields.io/badge/swift-5.2-orange.svg?style=flat"></a>
<a href="https://developer.apple.com/swift/"><img alt="Platforms" src="https://img.shields.io/cocoapods/p/GRDB.swift.svg"></a>
<a href="https://github.com/groue/GRDB.swift/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/github/license/groue/GRDB.swift.svg?maxAge=2592000"></a>
<a href="https://travis-ci.org/groue/GRDB.swift"><img alt="Build Status" src="https://travis-ci.org/groue/GRDB.swift.svg?branch=master"></a>
</p>
---
**Latest release**: April 11, 2021 • version 5.7.4 • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 4 to GRDB 5](Documentation/GRDB5MigrationGuide.md)
**Requirements**: iOS 10.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+ • SQLite 3.8.5+ • Swift 5.2+ / Xcode 11.4+
| Swift version | GRDB version |
| -------------- | ----------------------------------------------------------- |
| **Swift 5.2+** | **v5.7.4** |
| Swift 5.1 | [v4.14.0](https://github.com/groue/GRDB.swift/tree/v4.14.0) |
| Swift 5 | [v4.14.0](https://github.com/groue/GRDB.swift/tree/v4.14.0) |
| Swift 4.2 | [v4.14.0](https://github.com/groue/GRDB.swift/tree/v4.14.0) |
| Swift 4.1 | [v3.7.0](https://github.com/groue/GRDB.swift/tree/v3.7.0) |
| Swift 4 | [v2.10.0](https://github.com/groue/GRDB.swift/tree/v2.10.0) |
| Swift 3.2 | [v1.3.0](https://github.com/groue/GRDB.swift/tree/v1.3.0) |
| Swift 3.1 | [v1.3.0](https://github.com/groue/GRDB.swift/tree/v1.3.0) |
| Swift 3 | [v1.0](https://github.com/groue/GRDB.swift/tree/v1.0) |
| Swift 2.3 | [v0.81.2](https://github.com/groue/GRDB.swift/tree/v0.81.2) |
| Swift 2.2 | [v0.80.2](https://github.com/groue/GRDB.swift/tree/v0.80.2) |
**Contact**:
- Release announcements and usage tips: follow [@groue](http://twitter.com/groue) on Twitter.
- Report bugs in a [Github issue](https://github.com/groue/GRDB.swift/issues/new). Make sure you check the [existing issues](https://github.com/groue/GRDB.swift/issues?q=is%3Aopen) first.
- A question? Looking for advice? Do you wonder how to contribute? Fancy a chat? Go to the [GRDB forums](https://forums.swift.org/c/related-projects/grdb), or open a [Github issue](https://github.com/groue/GRDB.swift/issues/new).
## What is this?
GRDB provides raw access to SQL and advanced SQLite features, because one sometimes enjoys a sharp tool. It has robust concurrency primitives, so that multi-threaded applications can efficiently use their databases. It grants your application models with persistence and fetching methods, so that you don't have to deal with SQL and raw database rows when you don't want to.
Compared to [SQLite.swift](http://github.com/stephencelis/SQLite.swift) or [FMDB](http://github.com/ccgus/fmdb), GRDB can spare you a lot of glue code. Compared to [Core Data](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CoreData/) or [Realm](http://realm.io), it can simplify your multi-threaded applications.
It comes with [up-to-date documentation](#documentation), [general guides](#general-guides--good-practices), and it is [fast](https://github.com/groue/GRDB.swift/wiki/Performance).
See [Why Adopt GRDB?](Documentation/WhyAdoptGRDB.md) if you are looking for your favorite database library.
---
<p align="center">
<a href="#features">Features</a> •
<a href="#usage">Usage</a> •
<a href="#installation">Installation</a> •
<a href="#documentation">Documentation</a> •
<a href="#faq">FAQ</a>
</p>
---
## Features
GRDB ships with:
- [Access to raw SQL and SQLite](#sqlite-api)
- [Records](#records): Fetching and persistence methods for your custom structs and class hierarchies.
- [Query Interface](#the-query-interface): A swift way to avoid the SQL language.
- [Associations]: Relations and joins between record types.
- [WAL Mode Support](#database-pools): Extra performance for multi-threaded applications.
- [Migrations]: Transform your database as your application evolves.
- [Database Observation]: Observe database changes and transactions.
- [Combine Support]: Access and observe the database with Combine publishers.
- [RxSwift Support](http://github.com/RxSwiftCommunity/RxGRDB): Access and observe the database with RxSwift observables.
- [Full-Text Search]
- [Encryption](#encryption)
- [Support for Custom SQLite Builds](Documentation/CustomSQLiteBuilds.md)
## Usage
<details open>
<summary>Start using the database in four easy steps</summary>
```swift
import GRDB
// 1. Open a database connection
let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
// 2. Define the database schema
try dbQueue.write { db in
try db.create(table: "player") { t in
t.autoIncrementedPrimaryKey("id")
t.column("name", .text).notNull()
t.column("score", .integer).notNull()
}
}
// 3. Define a record type
struct Player: Codable, FetchableRecord, PersistableRecord {
var id: Int64
var name: String
var score: Int
}
// 4. Access the database
try dbQueue.write { db in
try Player(id: 1, name: "Arthur", score: 100).insert(db)
try Player(id: 2, name: "Barbara", score: 1000).insert(db)
}
let players: [Player] = try dbQueue.read { db in
try Player.fetchAll(db)
}
```
</details>
<details>
<summary>Activate the WAL mode</summary>
```swift
import GRDB
// Simple database connection
let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
// Enhanced multithreading based on SQLite's WAL mode
let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
```
See [Database Connections](#database-connections)
</details>
<details>
<summary>Access to raw SQL</summary>
```swift
try dbQueue.write { db in
try db.execute(sql: """
CREATE TABLE place (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL,
favorite BOOLEAN NOT NULL DEFAULT 0,
latitude DOUBLE NOT NULL,
longitude DOUBLE NOT NULL)
""")
try db.execute(sql: """
INSERT INTO place (title, favorite, latitude, longitude)
VALUES (?, ?, ?, ?)
""", arguments: ["Paris", true, 48.85341, 2.3488])
let parisId = db.lastInsertedRowID
// Avoid SQL injection with SQL interpolation
try db.execute(literal: """
INSERT INTO place (title, favorite, latitude, longitude)
VALUES (\("King's Cross"), \(true), \(51.52151), \(-0.12763))
""")
}
```
See [Executing Updates](#executing-updates)
</details>
<details>
<summary>Access to raw database rows and values</summary>
```swift
try dbQueue.read { db in
// Fetch database rows
let rows = try Row.fetchCursor(db, sql: "SELECT * FROM place")
while let row = try rows.next() {
let title: String = row["title"]
let isFavorite: Bool = row["favorite"]
let coordinate = CLLocationCoordinate2D(
latitude: row["latitude"],
longitude: row["longitude"])
}
// Fetch values
let placeCount = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM place")! // Int
let placeTitles = try String.fetchAll(db, sql: "SELECT title FROM place") // [String]
}
let placeCount = try dbQueue.read { db in
try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM place")!
}
```
See [Fetch Queries](#fetch-queries)
</details>
<details>
<summary>Database model types aka "records"</summary>
```swift
struct Place {
var id: Int64?
var title: String
var isFavor
没有合适的资源?快使用搜索试试~ 我知道了~
Swift项目模仿鲨鱼记账项目代码.zip
共1913个文件
png:855个
json:782个
swift:206个
4 下载量 189 浏览量
2024-06-03
16:16:36
上传
评论
收藏 9.79MB ZIP 举报
温馨提示
Swift项目模仿鲨鱼记账项目代码.zip Swift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账项目代码.zipSwift项目模仿鲨鱼记账
资源推荐
资源详情
资源评论
收起资源包目录
Swift项目模仿鲨鱼记账项目代码.zip (1913个子文件)
.gitignore 2KB
grdb_config.h 2KB
Pods-TestSwiftDemo-umbrella.h 328B
GRDB.swift-umbrella.h 324B
ObjectMapper-umbrella.h 316B
SwiftyJSON-umbrella.h 312B
SnapKit-umbrella.h 306B
Contents.json 2KB
Contents.json 402B
Contents.json 379B
Contents.json 378B
Contents.json 378B
Contents.json 378B
Contents.json 378B
Contents.json 372B
Contents.json 369B
Contents.json 369B
Contents.json 367B
Contents.json 367B
Contents.json 365B
Contents.json 365B
Contents.json 363B
Contents.json 361B
Contents.json 361B
Contents.json 361B
Contents.json 359B
Contents.json 359B
Contents.json 359B
Contents.json 359B
Contents.json 359B
Contents.json 359B
Contents.json 357B
Contents.json 357B
Contents.json 357B
Contents.json 357B
Contents.json 355B
Contents.json 355B
Contents.json 355B
Contents.json 355B
Contents.json 355B
Contents.json 355B
Contents.json 355B
Contents.json 353B
Contents.json 353B
Contents.json 353B
Contents.json 353B
Contents.json 353B
Contents.json 353B
Contents.json 351B
Contents.json 351B
Contents.json 351B
Contents.json 351B
Contents.json 351B
Contents.json 351B
Contents.json 351B
Contents.json 351B
Contents.json 351B
Contents.json 351B
Contents.json 351B
Contents.json 351B
Contents.json 351B
Contents.json 351B
Contents.json 349B
Contents.json 349B
Contents.json 347B
Contents.json 347B
Contents.json 347B
Contents.json 345B
Contents.json 341B
Contents.json 335B
Contents.json 335B
Contents.json 335B
Contents.json 335B
Contents.json 333B
Contents.json 333B
Contents.json 332B
Contents.json 332B
Contents.json 331B
Contents.json 331B
Contents.json 331B
Contents.json 331B
Contents.json 330B
Contents.json 330B
Contents.json 330B
Contents.json 330B
Contents.json 330B
Contents.json 330B
Contents.json 330B
Contents.json 330B
Contents.json 330B
Contents.json 329B
Contents.json 329B
Contents.json 329B
Contents.json 329B
Contents.json 329B
Contents.json 329B
Contents.json 329B
Contents.json 329B
Contents.json 329B
Contents.json 329B
共 1913 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
盈梓的博客
- 粉丝: 9560
- 资源: 2308
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- T型3电平逆变器,lcl滤波器滤波器参数计算,半导体损耗计算,逆变电感参数设计损耗计算 mathcad格式输出,方便修改 同时支持plecs损耗仿真,基于plecs的闭环仿真,电压外环,电流内环
- 毒舌(解锁版).apk
- 显示HEX、S19、Bin、VBF等其他汽车制造商特定的文件格式
- 8bit逐次逼近型SAR ADC电路设计成品 入门时期的第三款sarADC,适合新手学习等 包括电路文件和详细设计文档 smic0.18工艺,单端结构,3.3V供电 整体采样率500k,可实现基
- 操作系统实验 ucorelab4内核线程管理
- 脉冲注入法,持续注入,启动低速运行过程中注入,电感法,ipd,力矩保持,无霍尔无感方案,媲美有霍尔效果 bldc控制器方案,无刷电机 提供源码,原理图
- Matlab Simulink#直驱永磁风电机组并网仿真模型 基于永磁直驱式风机并网仿真模型 采用背靠背双PWM变流器,先整流,再逆变 不仅实现电机侧的有功、无功功率的解耦控制和转速调节,而且能实
- 157389节奏盒子地狱模式第三阶段7.apk
- 操作系统实验ucore lab3
- DG储能选址定容模型matlab 程序采用改进粒子群算法,考虑时序性得到分布式和储能的选址定容模型,程序运行可靠 这段程序是一个改进的粒子群算法,主要用于解决电力系统中的优化问题 下面我将对程序进行详
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功