iOS 数据库 canDB.swift

码农软件 · 软件分类 · iOS 数据库 · 2019-05-22 08:57:34

软件介绍

canDB.swift 是一个框架,作用类似 nonSQL 的数据库,但运作在 sqlite(FMDB) 。

    // loading the json
    let filePath = NSBundle.mainBundle().pathForResource("data", ofType:"json")    let data = NSData(contentsOfFile:filePath!, options:NSDataReadingOptions.DataReadingUncached, error:nil)    let dataArray:Array = NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.allZeros, error: nil) as! Array<Dictionary<String, String>>

    // singleton instance
    let storeInstance = canDB.sharedInstance    // saving the data, the can is automatically created if not exists
    storeInstance.saveData("Person", data: dataArray, idString: kCanDBDefaultIdString, error: nil)    // adding the index for future queries and reindexing the table
    storeInstance.addIndex("Person", indexes: ["Name"], error: nil)
    storeInstance.reIndex("Person", idString: kCanDBDefaultIdString)    let result = storeInstance.loadData("Person")    for item in result {        for (key, value) in (item as! NSDictionary) {
            println("\(key): \(value)")
        }
    }    // custom query using the previous created index "Name"
    let resultWithQuery = storeInstance.loadDataWithQuery("SELECT * FROM Person WHERE Name='John'")    for item in resultWithQuery {        for (key, value) in (item as! NSDictionary) {
            println("\(key): \(value)")
        }
    }

    storeInstance.removeDataForId("Person", idString: kCanDBDefaultIdString, idsToDelete: ["17", "19"], error: nil)

本文地址:https://codercto.com/soft/d/6280.html

运营有道:重新定义互联网运营

运营有道:重新定义互联网运营

李明轩 / 机械工业出版社 / 2017-7-31 / 69.00元

本书是前百度资深运营专家多年运营经验的总结,是作者运营千万级用户规模的大型互联网产品的实操经验复盘,是作者在“在行”上为近百位CEO和高管提供互联网运营咨询服务后对互联网运营需求的深入洞见。 本书的思想基础是“运营必须以用户为中心”,从产品、用户、市场3个维度对互联网运营重新进行了系统性的梳理:从道的层面解读并重新定义运营方法论,从术的层面围绕方法论提出行之有效的解决方法和实际案例。重点不在......一起来看看 《运营有道:重新定义互联网运营》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器