sqlcwrap

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const EntliteAccessFileName = "entlite_access.go"

EntliteAccessFileName is the file entlite adds to sqlc's generated package to expose the connection handle that sqlc keeps in an unexported field. sqlc only rewrites the files it generates itself, so this one survives regeneration.

Variables

This section is empty.

Functions

func Generate

func Generate(inputFilePath string, pbDir string, parsedEntities []schema.Entity, entityImports map[string]internalParser.ImportInfo, sqlDialect schema.SQLDialect) (string, error)

func GenerateAccessFile

func GenerateAccessFile(packageName string) string

GenerateAccessFile emits the sqlc-package addition described above. The wrapper package needs the handle to open a transaction around multi-row operations; without it the unexported field is unreachable.

func GenerateConvertFile

func GenerateConvertFile(packageName string, entities []schema.Entity) string

func PackageNameOf

func PackageNameOf(dir string) (string, error)

PackageNameOf reads the package clause of the first Go file in dir. sqlc's package name comes from sqlc.yaml and need not match the directory name, so it has to be read from the generated source rather than guessed.

Types

type FileType

type FileType int

FileType represents the type of sqlc-generated file being wrapped

const (
	FileTypeUnknown FileType = iota
	FileTypeQuery            // *.sql.go files (queries.sql.go, etc.)
	FileTypeModel            // models.go
	FileTypeDB               // db.go
)

Jump to

Keyboard shortcuts

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