On this page

Introduction

Seagull turns schema migrations and SQL queries into a typed Go data layer. You keep control of the SQL and the database connection. Seagull resolves names, infers result and parameter types, reports diagnostics, and emits Go methods you can read.

-- sgl.query(GetTask, one)
SELECT id, title FROM tasks WHERE id = ?;

A query like this becomes a method taking a context and an ID and returning a typed row and an error. The exact types follow the schema, dialect and emitter.

Three ways to use Seagull

  • Use sgl to generate packages, check SQL in CI, inspect schemas and run migrations.
  • Call the Go library from a build tool, editor or framework.
  • Use the browser playground to inspect SQL and generated Go before adding a tool to a project.

Generating code normally needs no running database. Running that code does need the relevant driver and a database. Live introspection also needs a database connection. Generated queries do not require the Seagull generator at runtime; an application that embeds migrations deliberately links the smaller migration runtime.

Choose a starting point

Start with installation, then your first query. Already using Seagull? Browse task guides or the reference. For the design, read from SQL to Go.

Seagull began inside Piko and now works independently. Piko's bridge retains its piko. directives and framework settings; standalone projects use sgl. comments and Seagull configuration. If you are working inside Piko, start with its database guides for the framework's connection and build workflow. Seagull is in alpha: pin the tool version and read compatibility before upgrading.