3 Star 6 Fork 0

Gitee 极速下载 / autosqlite-swift

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/TonyReet/AutoSQLite.swift.git
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

AutoSQLite.swift

SQLite.swift的封装,使用swift的反射原理,Model直接存储.获取. 无需再转换,增删改查. 脱离sql语句,不需要添加相关的绑定操作,直接完成转换。

png

使用方法

    1. 导入

A. Pod导入

  pod 'AutoSQLiteSwift'

B. 引入source目录下的文件文件:

SQLiteModel.swift
SQLiteDataBase.swift
SQLiteDataBaseTool.swift
SQLMirrorModel.swift
SQLPropertyModel.swift

创建model继承SQLiteModel即可
    1. 使用以下方法
        // 创建dataBase,
        var manager = SQLiteDataBase.createDB("testDataBaseName")
        // 插入
        manager.insert(object: testModel, intoTable: "testTableName")
        
        或者
        
        SQLiteDataBase.insert(object: testModel, intoTable: "testTableName")
        // 删除
        manager.delete(testModel, fromTable: "testTableName")
        
        或者
        
        SQLiteDataBase.deleteModel(testModel, fromTable: "testTableName")
        
        // 更新
        testModel.name = "Reet"

        manager.update(testModel, fromTable: "testTableName")
        
        或者
        
        SQLiteDataBase.update(testModel, fromTable: "testTableName")
        // 查询
        guard let results = manager.select(testModel, fromTable: "testTableName") else {
            sqlitePrint("没有查询到数据")
            return
        }

        for result in results {
            sqlitePrint("查询的数据\(result)")
        }
        
        或者
        
        let results = SQLiteDataBase.select(testModel, fromTable: "testTableName")

        if results.count > 0{
            for result in results {
                sqlitePrint("查询的数据\(result)")
            }
        }else {
            sqlitePrint("没有查询到数据")
        }

upgrade

####19.7.30
新增可选类型(optional) ####19.4.23
新增字段时,直接在表里面添加,避免报错

有任何疑问或建议. 欢迎提issue。

MIT License Copyright (c) 2017 TonyReet Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

SQLite.swift的封装,使用swift的反射原理,Model直接存储.获取. 无需再转换,增删改查. 脱离sql语句,不需要添加相关的绑定操作,直接完成转换。 展开 收起
Swift 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Swift
1
https://gitee.com/mirrors/autosqlite-swift.git
git@gitee.com:mirrors/autosqlite-swift.git
mirrors
autosqlite-swift
autosqlite-swift
master

搜索帮助