sqlc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package sqlc provides the sqlc codegen plugin entry point and configuration parsing for sqlc-gen-template.

Index

Constants

View Source
const PluginName = "template"

PluginName is the name under which this plugin is typically registered in sqlc.yaml.

Variables

This section is empty.

Functions

func Generate

Generate is the sqlc codegen entry point. It parses plugin options, walks the configured template directory, renders each template against the raw GenerateRequest, and returns the produced files.

Types

type Options

type Options struct {
	// TemplatesDir is the directory to walk for *.tmpl files. Required.
	// Relative paths resolve against the sqlc configuration directory.
	TemplatesDir string `json:"templates_dir"`
	// Extra is a free-form map surfaced to templates as .Options.Extra.
	Extra map[string]any `json:"extra,omitempty"`
}

Options holds plugin-specific options decoded from the JSON payload that sqlc sends in GenerateRequest.PluginOptions.

func ParseOptions

func ParseOptions(data []byte) (Options, error)

ParseOptions decodes the JSON plugin options payload. Unknown fields are rejected to catch typos in sqlc.yaml. An empty payload yields zero-value Options, which then fails Validate().

func (Options) Validate

func (o Options) Validate() error

Validate returns an error if required options are missing.

Directories

Path Synopsis
Package template discovers, parses, and renders user-supplied Go templates against a sqlc GenerateRequest.
Package template discovers, parses, and renders user-supplied Go templates against a sqlc GenerateRequest.

Jump to

Keyboard shortcuts

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