Git Product home page Git Product logo

autosqlite.swift's Introduction

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。

autosqlite.swift's People

Contributors

songjiang1999 avatar tonyreet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

autosqlite.swift's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.