Skip to main content

Compatibility

ant hasn't reached 1.0, so anything can change between releases. Each release's release notes list its breaking changes.

Go​

ant needs Go 1.27 or later, because its API uses generic methods. Each release supports the two newest Go versions.

FeatureSinceUsed for
iter.Seq2Go 1.23Streaming with Each
new(expr)Go 1.26Nullable values, as in user.Bio = new("text")
Generic methodsGo 1.27Join[J], Include[R], Select[R] in fluent chains
Field selectors as struct literal keysGo 1.27User{ID: 1} for fields promoted from ant.Base

Databases​

DatabaseStatus
PostgreSQL 13 to 18Supported: the whole suite passes on each, as of 2026-11-01
MySQL 8.4, MariaDB 11.8, SQLite (modernc 1.61), SQL Server 2022Queries and writes: the conformance and concurrency suites pass. No migrations

MERGE needs PostgreSQL 15. Everything else works from 13. PostgreSQL 12 and older are out of support upstream and untested here. The comments in each dialect name the oldest versions expected to work, from their documentation, but only the versions above have been run.

ant runs on the pgx driver through database/sql. pgxext needs pgx. See databases for what each database lacks.

Breaking changes so far​

The latest release is v0.3.2. Before it came v0.1.0, v0.2.0, v0.3.0 and v0.3.1.

v0.3.2​

No exported name changed or went away. It adds ant.ErrNestedIsolation, pgxext.ErrInTx, metrics.Operation and JSON decoding for secure.Value. Some behaviour changed, mostly where ant used to misread something without a word and now refuses it:

v0.3.1​

No breaking changes. It cuts allocations and time on reads, tracking, saves and inserts, with the same API. The dialect and qb packages gain helpers for a dialect to write into ant's render buffer.

v0.3.0​

No exported name changed, but some behaviour did:

The docs and examples now name a probe after its model in the plural, Users = ant.Fields[User](), instead of U. That is a naming convention, not an API change: old code still compiles.

v0.2.0​

v0.2.0 made the first breaking change: the helpers that read or mark the change tracker now take a context.Context, and those that returned nothing now return an error.

Beforev0.2.0
ant.Add(db, e), Attach, Remove, MarkModifiedant.Add(ctx, db, e), and so on, returning error as before
ant.Detach(db, e)ant.Detach(ctx, db, e) error
ant.TrackGraph(db, root, decide)ant.TrackGraph(ctx, db, root, decide)
ant.Tracked[T](db)ant.Tracked[T](ctx, db) ([]*T, error)
ant.Entry(db, e)ant.Entry(ctx, db, e) (*EntityEntry[T], error)
db.HasChanges()db.HasChanges(ctx) (bool, error)
db.ClearTracked()db.ClearTracked(ctx) error
db.DebugTracked()db.DebugTracked(ctx) (string, error)

The context lets ant tell a hook that runs inside an operation from another goroutine using the same tracking context, which gets ErrConcurrentUse. Pass the context your hook or handler received. A call made with an unrelated context while another operation holds the tracker is refused.

go build ./... finds every call to change.

From 1.0​

ant will follow semantic versioning: patch releases fix bugs, minor releases add to the API and change nothing that exists, and major releases can break things, with notes on how to move.

The API is:

  • Every exported name in the public packages, which a test keeps a record of in docs/api.txt.
  • The behaviour the documentation and tests/features describe.
  • The migration file format, and the history table.

The API isn't:

  • Anything under internal.
  • The exact SQL ant writes, which can change as long as it means the same.
  • The text of error messages. Match errors with errors.Is.
  • The dialect and qb packages, until a dialect outside this module exists to settle them.

Files that outlive a release​

Migrations and snapshots stay readable. A snapshot records its format, and a newer format is refused with a clear error, not misread. The history table only gains columns.

Upgrade a project​

  1. Read the release notes for each version you cross.
  2. Update the module: go get github.com/skudra-go/ant@latest.
  3. Run go build ./.... A renamed or changed API fails here.
  4. Run your tests against a real database.
  5. Run go run ./cmd/migrate check. A release can change how a model maps to a schema; this shows it.
  6. Run go run ./cmd/migrate drift against a staging database.