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

generator

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package generator writes the Go models of a dbspec document set; the orm-gen command and other programs call it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(options Options) ([]string, error)

Check generates the models like Generate without changing OutputDir or its parent directory and returns one line for each generated file that differs, is missing, or is extra, ordered by path.

func Generate

func Generate(options Options) error

Generate writes the Go models of the runtime model to OutputDir. The generated files of OutputDir are replaced after the scan converges; any other error leaves OutputDir unchanged. A *ScannedSourceError reports scanned packages that do not compile with the complete models written to OutputDir.

Types

type Options

type Options struct {
	// Model is the runtime model of a dbspec document set.
	Model     *runtimemodel.Model
	OutputDir string
	// PackageName selects the Go package name; the directory name by default.
	PackageName string
	// Scan lists the Go package patterns whose model calls are generated.
	Scan []string
}

Options describes one deterministic Go generation request.

type ScannedSourceError

type ScannedSourceError struct {
	Errors []string
}

ScannedSourceError reports scanned packages that do not compile with the generated models. The output directory holds the complete generated models when generation returns it.

func (*ScannedSourceError) Error

func (e *ScannedSourceError) Error() string

Jump to

Keyboard shortcuts

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