A type-safe MySQL client library for Swift, inspired by Node.js mysql, with Codable result mapping.
mysql-swift is a MySQL client library for Swift that enables type-safe database interactions. It allows developers to execute raw SQL queries with proper escaping and map results directly to Swift's Codable types, reducing boilerplate and improving data integrity. The library is inspired by Node.js's mysql package and provides familiar query formatting.
Swift developers building server-side applications or tools that require MySQL database connectivity, particularly those who value type safety and Codable integration.
Developers choose mysql-swift for its straightforward type-safe querying, Codable result mapping that eliminates manual row parsing, and its similarity to the popular Node.js mysql interface, making it intuitive for those with JavaScript experience.
A type safe MySQL client for Swift
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Executes raw SQL with parameterized inputs to prevent injection, as shown in query examples using QueryParameter for safe formatting.
Automatically maps database rows to Swift structs or classes via Codable, reducing boilerplate for model mapping, demonstrated in the User struct example.
Uses Node.js-style query formatting with placeholders like '?', making it intuitive for developers transitioning from JavaScript's mysql library.
Includes built-in connection pools via ConnectionPool for efficient database resource management, as outlined in the usage section.
The README explicitly states it's obsolete and not maintained, directing users to MySQLNIO, meaning no future updates, bug fixes, or security patches.
Lacks asynchronous I/O support, relying on synchronous libmysqlclient calls, which limits compatibility with Swift's modern async/await patterns.
Requires installing specific pkg-config files via Homebrew taps (e.g., cmysql), adding setup complexity compared to more integrated solutions.
Depends solely on libmysqlclient, which can restrict performance optimizations and features available in other database drivers.