perfectlysoft/perfect-mariadb
A Swift wrapper around the MariaDB client library (libmariadb), enabling access to MariaDB/MySQL
macOS Build Notes
Package.swift declares platforms: [.macOS(.v12)].
To install the MariaDB connector:
brew install mariadb-connector-cLinux Build Notes
Linux is not declared in the platforms array in Package.swift (only .macOS(.v12) is), so it is not an officially asserted/tested target. That said, the mariadbclient system-library target still declares an .apt(["libmariadb-dev"]) provider, so a Linux build remains possible at the toolchain level if you ensure the library is installed:
sudo apt-get install pkg-config libmariadb-devTo test if pkg-config is working, try running the command:
pkg-config libmariadb --cflags --libsBuilding
This package is consumed within the Perfect-Resurrection monorepo as a local sibling checkout, not a tagged GitHub release. Add it to your Package.swift as a relative path dependency, alongside Perfect-CRUD (required, since Perfect-MariaDB's CRUD support depends on it):
dependencies: [
.package(path: "../Perfect-MariaDB"),
.package(path: "../Perfect-CRUD"),
],
targets: [
.target(
name: "YourTarget",
dependencies: [
"MariaDB",
.product(name: "PerfectCRUD", package: "Perfect-CRUD"),
]
),
]This means Perfect-MariaDB must be checked out alongside its sibling Perfect-Resurrection repos (in particular ../Perfect-CRUD) for the build to resolve.
Import required libraries:
import MariaDB
import PerfectCRUDPerfect-MariaDB implements the Perfect-CRUD protocol via MySQLDatabaseConfiguration (see Sources/MariaDB/MySQLCRUD.swift), letting Perfect-CRUD's declarative model/query API target a MariaDB/MySQL server. See Perfect-CRUD (a local sibling repo in this monorepo, not an external dependency) for the CRUD API itself.
Note: the source files retain their original MySQLCRUD.swift/MySQLStmt.swift naming from this package's shared lineage with Perfect-MySQL — MariaDB is wire-compatible with the MySQL client protocol, and the two packages are separate, independently-buildable connectors in this ecosystem.
Testing
A MariaDBTests target and a docker-compose.yml (spins up a local MariaDB container) are included for running the test suite against a real server.
Further Information
For background on the broader Perfect framework, see perfect.org and PerfectlySoft/Perfect.
Package Metadata
Repository: perfectlysoft/perfect-mariadb
Default branch: main
README: README.md