Documentation
¶
Overview ¶
Package mysql is the built-in MySQL/MariaDB dialect for the msgin sql adapter engine (github.com/kartaladev/msgin/adapter/database/sql). It owns the exact MySQL SQL for the lease/claim source, the lock/FOR UPDATE strategy, the outbound INSERT, and the idempotent-consumer dedup inbox — behavior-identical to the postgres dialect, expressed in MySQL SQL (LOCK IN SHARE MODE, UTC_TIMESTAMP(6), the two-step atomic claim MySQL's lack of RETURNING requires).
It is a leaf-test dialect module (ADR 0011): it requires the engine ONLY — no SQL driver, no testcontainers, no testify — so a production consumer that imports it pays only the engine's (stdlib + clockwork) dependency cost. The caller injects the MySQL database/sql driver (e.g. go-sql-driver/mysql) and provisions the *sql.DB; msgin does not import a driver. It also covers MariaDB (wire-compatible).
The public entry points are:
- LeaseDialect() — the msginsql.LeaseDialect passed to NewPollingSource/NewOutboundAdapter (the single stateless value also satisfies msginsql.LockDialect for WithStrategy(StrategyLockForUpdate)).
- InboxDialect() — the msginsql.InboxDialect passed to NewInboxDeduper.
- DDL(table) / InboxDDL(table) — the reference CREATE TABLE statements for callers to fold into their own migration tool (msgin never runs DDL on the production path; ADR 0010 D2).
Behavior is identical to the pre-split built-in: this package MOVED verbatim out of the engine (Plan 006 Task 5); only its module boundary changed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DDL ¶
DDL returns the reference CREATE TABLE statement for the lease/claim schema on MySQL, for callers to fold into their own migration tool. It validates table (ErrInvalidTableName on a bad identifier) before building the statement; msgin never runs this on the production path (ADR 0010 D2 — the caller provisions the schema). The claim index is declared INLINE (MySQL has no CREATE INDEX IF NOT EXISTS), so the whole schema is a single statement.
func GroupDDL ¶
GroupDDL returns the reference CREATE TABLE statements (group-lease table + member table, each with inline indexes) for the durable Aggregator group store on MySQL/MariaDB, for callers to fold into their own migration tool. It validates table (ErrInvalidTableName on a bad identifier) as the sole entry point — there is no string-returning DDL method on the GroupDialect interface to bypass validation (ADR 0021 §3). msgin never runs this on the production path (the caller provisions the schema).
func GroupDialect ¶
func GroupDialect() msginsql.GroupDialect
GroupDialect returns the built-in MySQL/MariaDB GroupDialect. Pass it as the required dialect argument to msginsql.NewGroupStore. It owns the exact MySQL-family group-aggregation SQL for the durable, multi-process Aggregator store; MariaDB rides on this dialect (wire-compatible) (ADR 0021).
func InboxDDL ¶
InboxDDL returns the reference CREATE TABLE (+ retention index) statement for the idempotent-consumer dedup inbox on MySQL, for callers to fold into their own migration tool (ADR 0010 D10). It validates table (ErrInvalidTableName on a bad identifier) as the sole entry point, applying the same identifier-injection discipline as DDL (reference finding I1): there is no string-returning DDL method on the InboxDialect interface to bypass validation.
func InboxDialect ¶
func InboxDialect() msginsql.InboxDialect
InboxDialect returns the built-in MySQL InboxDialect — the same stateless value as LeaseDialect(), narrowed to the dedup-inbox SPI (ADR 0010 D10). Pass it as the required dialect argument to NewInboxDeduper.
func LeaseDialect ¶
func LeaseDialect() msginsql.LeaseDialect
LeaseDialect returns the built-in MySQL LeaseDialect (lease/claim strategy), behavior-identical to postgres.LeaseDialect() over MySQL SQL. Pass it as the required dialect argument to NewPollingSource/NewOutboundAdapter; it also covers MariaDB (wire-compatible). The single stateless value also satisfies msginsql.LockDialect (for WithStrategy(StrategyLockForUpdate)) and msginsql.InboxDialect.
Types ¶
This section is empty.