$ show elixir-ecto/myxql
MyXQL is a MySQL database adapter for Elixir that provides connection pooling, query execution, prepared statements, transaction support, and streaming results. It implements the DBConnection behaviour for pooling and handles both text and binary protocols. The library features robust type conversion for MySQL data types (including JSON, geometric types, and custom types like DateTime and Decimal) and includes comprehensive error handling. The architecture separates concerns into modules for connection management (MyXQL.Connection), low-level protocol handling (MyXQL.Client and MyXQL.Protocol), and data type conversion (MyXQL.Protocol.Values).
The LLM identified 3 files worth highlighting for reuse:
Provides functions for encoding and decoding MySQL-specific length-prefixed integers and strings. These low-level utilities are the building blocks for the MySQL packet protocol and can be reused in any project needing to implement the MySQL wire protocol.
Handles conversion between MySQL data types (text and binary protocols) and Elixir terms. Covers integers, floats, decimals, dates, times, JSON, and geometric types, with special handling for edge cases like zero dates and time limits. This self-contained module demonstrates strong data type mapping skills and could be extracted for use in other database adapters.
Defines a behaviour for geometric type codecs and provides an implementation for the 'geo' library. Allows codec configuration via application settings, enabling easy swapping of geometric libraries. Demonstrates a clean plugin architecture pattern for handling optional dependencies.