sqlcdriver

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package sqlcdriver runs the pinned sqlc.

unison does not analyze SQL. sqlc does, and this package is the whole of unison's relationship with it: render a config, run the binary, report what it said. The orchestrator uses it to generate; the test suite uses it to prove the plugin round trip against a real analyzer rather than a hand-built protobuf.

Index

Constants

View Source
const RequireEnvVar = "UNISON_REQUIRE_SQLC"

RequireEnvVar turns a missing or mismatched sqlc from a skipped test into a failed one.

Locally, a clone without sqlc should still run everything else. In CI, a suite that quietly skips the tests that drive the real analyzer is worse than one that stops, because those are the tests that check anything at all.

Variables

View Source
var PinnedVersion = strings.TrimSpace(pinnedVersionFile)

PinnedVersion is the sqlc release unison is built and tested against.

It is a pin rather than a floor because the CodeGenRequest protobuf is a moving target and the analysis it carries is the input to every shape decision here. A consumer whose sqlc differs is generating from a different analyzer than the one the golden files were produced by.

Functions

func Run

func Run(ctx context.Context, binary, dir string, args ...string) (string, error)

Run invokes sqlc with the given arguments in dir.

stdout and stderr are captured rather than inherited: sqlc reports analysis errors on stdout, and a caller wants them in the error it returns rather than interleaved into whatever the process is already writing.

func Version

func Version(ctx context.Context, binary string) (string, error)

Version reports the version of the sqlc at binary.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL