Help us shape the future of Go! Take the 2026 Go Developer Survey

narsilc

package module
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 4 Imported by: 0

README

narsilc

narsilc is a fork of sqlc that can scan query results into caller-owned structs via generic methods and andurel tags.

With row_mapping: andurel, generated :one/:many methods scan into T unless *T implements narsilc.Transformer[Row]. Then they scan a generated row (UserRow, or AuthorPostCountsRow for a join) once and call Transform. database.nullType is unrelated: it is how SQL NULL is represented on the row and on 1:1 entities. Custom domain types do not need sql.Scanner if they use Transform.

go install github.com/mbvlabs/narsilc/cmd/narsilc@v0.1.0
narsilc generate

Release archives are narsilc_<version>_<os>_<arch>.tar.gz on GitHub Releases.

sqlc: A SQL Compiler

go Go Report Card

sqlc generates type-safe code from SQL. Here's how it works:

  1. You write queries in SQL.
  2. You run sqlc to generate code with type-safe interfaces to those queries.
  3. You write application code that calls the generated code.

Check out an interactive example to see it in action, and the introductory blog post for the motivation behind sqlc.

Overview

Supported languages

narsilc generates Go only.

Sponsors

Development is possible thanks to our sponsors. If you would like to support sqlc, please consider sponsoring on GitHub.

Coder.com Mint.fun Mux.com

Cyberax - NaNuNaNu - Stumble - WestfalNamur - alecthomas - cameronnewman - danielbprice - davherrmann - dvob - gilcrest - gzuidhof - jeffreylo - mmcloughlin - ryohei1216 - sgielen

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromRow added in v0.5.0

func FromRow[T, Row any](row Row) (T, error)

FromRow returns row when T is Row, calls Transform when *T implements Transformer[Row], and otherwise errors with both type names.

func Read added in v0.5.0

func Read[T, Row any](s Scanner, columns []string) (T, error)

Read scans once. If *T implements Transformer[Row], it scans into Row and calls FromRow; otherwise it scans into T (today's 1:1 path).

func Scan

func Scan[T any](s Scanner, columns []string) (T, error)

Types

type Placeholder

type Placeholder struct{}

Placeholder lets the module be installed and run as github.com/mbvlabs/narsilc.

type Scanner

type Scanner interface {
	Scan(dest ...any) error
}

type Transformer added in v0.5.0

type Transformer[Row any] interface {
	Transform(Row) error
}

Transformer maps a generated driver-native row into T. Implement on *T, not on the row type.

Directories

Path Synopsis
cmd
narsilc command
examples
internal
cache
Package cache implements sqlc's on-disk cache, designed after Bazel's local disk cache.
Package cache implements sqlc's on-disk cache, designed after Bazel's local disk cache.
cmd
core/seed
Package seed builds a core catalog for a SQL dialect from a declarative description of its type system: the types it defines, the operators and casts between them, and the functions it ships with.
Package seed builds a core catalog for a SQL dialect from a declarative description of its type system: the types it defines, the operators and casts between them, and the functions it ships with.
docs
Package docs validates the documentation content contract for docs/.
Package docs validates the documentation content contract for docs/.
ext
rpc
sql/ast/printer
Package printer implements the document renderer the SQL formatter prints through: a small Wadler-style engine, the model behind Prettier and ruff (via Biome's printer).
Package printer implements the document renderer the SQL formatter prints through: a small Wadler-style engine, the model behind Prettier and ruff (via Biome's printer).
sql/preprocess
Package preprocess rewrites sqlc's query syntax into native SQL before any engine parser sees a query.
Package preprocess rewrites sqlc's query syntax into native SQL before any engine parser sees a query.
sqlcdebug
Package sqlcdebug parses the SQLCDEBUG environment variable and exposes its key=value settings to the rest of the codebase.
Package sqlcdebug parses the SQLCDEBUG environment variable and exposes its key=value settings to the rest of the codebase.
sqlite3ext
Package sqlite3ext registers the SQLite extensions sqlc relies on with github.com/ncruces/go-sqlite3.
Package sqlite3ext registers the SQLite extensions sqlc relies on with github.com/ncruces/go-sqlite3.
vet
pkg
cli
package cli exposes the command-line interface for sqlc.
package cli exposes the command-line interface for sqlc.
build command
bump-version command

Jump to

Keyboard shortcuts

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