Kitura SQL Proof of Concept
Purpose
- Show an understanding of the Swift Language
- Familiarize myself with the LinuxSwift/Kitura ecosystem
- Provide something potentially useful to the community
Assumptions
- IBM would like to expand Kitura adoption and Mindshare
- App developers are a target market for the Kitura ecosystem
- App developers are used to writing apps against Rails-style REST interfaces
- There doesn't seem to be a SQL interface for Kitura persistence
- Creating a SQL-based easily-configured persistence option for Kitura would be useful to app developers (and hopefully other developers as well)
User-Facing Features
- Drop-in SQL persistence mechanism
- Basic REST Object CRUD functionality
- Dynamically-Altered schema, driven by PUT and POST operations
- Switch to turn dynamic-updating on or off
- WebService runs on OS X or Linux (although numbers are returned as Strings under Linux for now to avoid a JSON encoding issue)
Software Design Features
- Kitura-SQLite module has XCTest Integration tests that run under OS X and Linux
- Developers can build on this functionality by defining their own routes
- Protocol abstracted to allow different SQL library implementations with minimal changes to the web service
- Currently with only SQLite implemented as a back-end
- Hopefully & eventually this can expand
Components
- Kitura-SQL-PoC Proof-of-Concept Persistence Layer for Kitura (this repository)
- Kitura-SQLProtocol - An abstraction layer to sit in between Kitura and various SQL library implementations
- Kitura-SQLite a SQLite-based implementation of the KituraSQLProtocol
- CSQLite - A very simple Swift wrapper around libsqlite3 (primarily a modules.map and Package.swift file)
Still Lacking
- Need to write code to create and query join-tables dynamically
- Need to define default routes for queries other than
All
andby ID
- Fix issue with JSON encoding failing for Int/Real dictionary values
- Add support for BLOB/DATE types
- Need to audit for security, and sanitize the JSON input
- Move Logging to be consistent with other packages
- Need to tune for performance
- Currently the sqlite file is being closed at the end of each query for safety, which won't scale