generator

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllAppTypes = []AppType{
	Web,
	API,
}
View Source
var AllDatabases = []Database{
	SQLite3,
	Postgres,
	MySQL,
}

Functions

func CreateTemplateFuncs added in v0.19.0

func CreateTemplateFuncs(cfg *GeneratorConfig) template.FuncMap

func Generate

func Generate(cfg *GeneratorConfig) error

func LoadDatabaseMigration

func LoadDatabaseMigration(db Database, filename string) (string, error)

func LoadDatabaseQuery

func LoadDatabaseQuery(db Database, filename string) (string, error)

func ProcessFileRenames added in v0.19.0

func ProcessFileRenames(project *Project, outputPath string, renames *FileRenames) error

func RunCommand added in v0.19.0

func RunCommand(workingDir string, command Command) error

func RunGitCommands added in v0.19.0

func RunGitCommands(outputPath string) error

func RunPostCommands added in v0.19.0

func RunPostCommands(project *Project, outputPath string) error

func ShouldExcludeFile added in v0.19.0

func ShouldExcludeFile(path string, project *Project, exclusions *FileExclusions) bool

Types

type AppType added in v0.19.0

type AppType string
const (
	Web AppType = "web"
	API AppType = "api"
)

func (AppType) IsValid added in v0.19.0

func (t AppType) IsValid() bool

type Command added in v0.19.0

type Command struct {
	Message string
	Name    string
	Args    []string
}

type Database

type Database string
const (
	SQLite3  Database = "sqlite3"
	Postgres Database = "postgres"
	MySQL    Database = "mysql"
)

func (Database) ConnString

func (d Database) ConnString(projectName string) string

func (Database) Driver

func (d Database) Driver() string

func (Database) GooseDBString

func (d Database) GooseDBString(projectName string) string

func (Database) GooseDialect

func (d Database) GooseDialect() string

func (Database) GooseDriver

func (d Database) GooseDriver() string

func (Database) Import

func (d Database) Import() string

func (Database) IsValid

func (d Database) IsValid() bool

func (Database) SQLCEngine

func (d Database) SQLCEngine() string

func (Database) String

func (d Database) String() string

type FileExclusions added in v0.19.0

type FileExclusions struct {
	ByAppType  map[AppType][]string
	ByDatabase map[Database][]string
}

func CreateFileExclusions added in v0.19.0

func CreateFileExclusions() *FileExclusions

type FileRenames added in v0.19.0

type FileRenames struct {
	ByAppType map[AppType]map[string]string
}

func CreateFileRenames added in v0.19.0

func CreateFileRenames() *FileRenames

type GeneratorConfig added in v0.19.0

type GeneratorConfig struct {
	Name      string
	Database  Database
	AppType   AppType
	InitGit   bool
	OutputDir string
}

type Project

type Project struct {
	Name     string
	Database Database
	AppType  AppType
}

Jump to

Keyboard shortcuts

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