generator

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderInspectionReport added in v1.1.0

func RenderInspectionReport(report InspectionReport, format string) (string, error)

RenderInspectionReport renders the inspection report in the requested format.

func RenderInspectionStarterConfig added in v1.1.0

func RenderInspectionStarterConfig(cfg config.Config, report InspectionReport) string

RenderInspectionStarterConfig renders a versioned TOML starter config using the provided PostgreSQL connection settings and inspection recommendations.

func WritePostgresDBInit

func WritePostgresDBInit(cfg config.Config, g *gen.Generator) error

func WriteSQLiteDBInit

func WriteSQLiteDBInit(cfg config.Config, g *gen.Generator) error

Types

type InspectionColumnUsage added in v1.1.0

type InspectionColumnUsage struct {
	ObjectName string
	ObjectKind string
	ColumnName string
}

type InspectionObject added in v1.1.0

type InspectionObject struct {
	Name string
	Kind string
}

type InspectionRecommendation added in v1.1.0

type InspectionRecommendation string
const (
	InspectionRecommendationNone     InspectionRecommendation = ""
	InspectionRecommendationTypeMap  InspectionRecommendation = "type_map"
	InspectionRecommendationGenerate InspectionRecommendation = "generate"
	InspectionRecommendationManual   InspectionRecommendation = "manual"
)

type InspectionReport added in v1.1.0

type InspectionReport struct {
	Dialect  config.DatabaseDialect
	Objects  []InspectionObject
	Findings []InspectionTypeFinding
}

type InspectionTypeFinding added in v1.1.0

type InspectionTypeFinding struct {
	DBType                 string
	Kind                   InspectionTypeKind
	BaseDBType             string
	CurrentMapping         string
	MappingSource          string
	SuggestedGoType        string
	Recommendation         InspectionRecommendation
	SuggestedImportPath    string
	SuggestedImportPackage string
	DomainBaseType         string
	EnumLabels             []string
	Usages                 []InspectionColumnUsage
	Note                   string
}

type InspectionTypeKind added in v1.1.0

type InspectionTypeKind string
const (
	InspectionTypeEnum        InspectionTypeKind = "enum"
	InspectionTypeDomain      InspectionTypeKind = "domain"
	InspectionTypeEnumArray   InspectionTypeKind = "enum_array"
	InspectionTypeDomainArray InspectionTypeKind = "domain_array"
	InspectionTypeCustom      InspectionTypeKind = "custom"
	InspectionTypeCustomArray InspectionTypeKind = "custom_array"
)

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(logger *slog.Logger) *Service

func (*Service) Generate

func (s *Service) Generate(ctx context.Context, cfg config.Config) error

func (*Service) Inspect added in v1.1.0

func (s *Service) Inspect(ctx context.Context, cfg config.Config) (InspectionReport, error)

Inspect analyzes the configured database and reports type-mapping guidance.

Jump to

Keyboard shortcuts

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