generation

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NullInt64 = "usql.NullInt64"
)

Variables

View Source
var Helpers = template.FuncMap{
	"has_primary_key":        hasPrimaryKey,
	"has_autoinc":            hasAutoIncrementingKey,
	"primary_autoinc_column": primaryAutoIncColumn,
	"autoinc_column":         autoIncColumn,
	"non_autoinc_columns":    nonAutoIncColumns,
	"lcfirst":                xstrings.FirstRuneToLower,
	"identity_columns":       identityColumns,
	"non_identity_columns":   nonIdentityColumns,
	"structify":              structify,
	"enum_columns":           enumColumns,
	"unique_column_keys":     uniqueColumnKeys,
	"sorted_columns":         sortedColumns,
	"get_type":               getType,
	"get_tags":               getTags,
}

Helpers defines the map of functions exposed to generation templates

Functions

func FmtTemplates added in v0.0.9

func FmtTemplates(outputLoc string) error

func GoimportsInstallIfNeeded added in v0.0.8

func GoimportsInstallIfNeeded() error

func InstallGoimports added in v0.0.8

func InstallGoimports() error

func IsGoimportsInstalled added in v0.0.8

func IsGoimportsInstalled() bool

func LoadSQL

func LoadSQL(paths ...string) ([]*entities.Table, error)

LoadSQL loads all SQL files in the given paths and parses them

func RenderTemplates

func RenderTemplates(tables []*entities.Table, templatesLoc, outputLoc, fileExtensionPrefix string) error

func RenderWithTemplates added in v0.0.8

func RenderWithTemplates(fs embed.FS, tables []*entities.Table, outputLoc, fileExtensionPrefix string) error

RenderWithTemplates renders templates that are provided as embedded files

Types

This section is empty.

Jump to

Keyboard shortcuts

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