model_schema

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoGoFilesFound indicates no .go files were found in the directory.
	ErrNoGoFilesFound = errors.New("no .go files found in directory")
	// ErrNoPackagesFound indicates no packages were found during parsing.
	ErrNoPackagesFound = errors.New("no packages found")
	// ErrMultiplePackages indicates multiple packages were found when expecting one.
	ErrMultiplePackages = errors.New("expected 1 package, found multiple")
	// ErrFileNotFoundInPackage indicates the target file was not found in the package.
	ErrFileNotFoundInPackage = errors.New("file not found in package")
)

Functions

func Command

func Command() *cobra.Command

Command returns the generate-model-schema cobra command.

func GenerateDirectory

func GenerateDirectory(inputDir, outputDir, packageName string) error

GenerateDirectory processes all .go files in a directory and generates corresponding schemas.

func GenerateFile

func GenerateFile(inputFile, outputFile, packageName string) error

GenerateFile processes a single model file and generates its schema file.

Types

type ModelField

type ModelField struct {
	GoName     string
	ColumnName string
	MethodName string
	Label      string
}

ModelField represents a single field in a model struct with its Go and database metadata.

type ModelSchemaInfo

type ModelSchemaInfo struct {
	PackageName    string
	ModelName      string
	SchemaTypeName string
	VarName        string
	TableName      string
	AliasName      string
	Fields         []ModelField
}

ModelSchemaInfo contains complete metadata for generating a model schema helper.

Jump to

Keyboard shortcuts

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