ulrikdamm / sqlable Goto Github PK
View Code? Open in Web Editor NEWSwift library for making storing data in a SQLite database simple and magic-free
License: MIT License
Swift library for making storing data in a SQLite database simple and magic-free
License: MIT License
Hi,
This library is really useful, i came into an issue that i need to alter my table to add new column, is there away to easily do that?
The observe interface takes a Int id:
public func observe<T : Sqlable>(change: Sqlable.SqliteDatabase.Change? = default, on: T.Type, id: Int? = default, doThis: (id: Int) throws -> Void) -> String
Problem is I have to use String
key for my model (some of the integer is bigger than 32bit and will not work on older devices).
byId
will throw error "Could not cast value of type 'Swift.Optional<SqlableTests.Type>' to 'SqlableTests.Type'", if the id is not found on database. This happens only in Swift 2.3 (Xcode 7.3)
func testById() {
try! db.createTable(Group.self)
let group = Group(id: 0)
try! group.insert().run(db)
if let _ = try! Group.byId(1).run(db) {
XCTFail("group should not be found")
} else {
XCTAssert(true)
}
}
Hi,
I want to do like FMDB
let rs = try db.executeQuery("select id,count(id) as count from table_cart group by id, selected_addons", values: nil) while rs.next() { result["\(rs.int(forColumn: "id"))" ] = "\(rs.int(forColumn: "count"))" print(rs) }
how can i do it with this library?
Hi,
How do i open/close the db?
is it enough to do SqliteDatabase(...)
thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.