config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldInt       string = "int"
	FieldString    string = "string"
	FieldTimestamp string = "timestamp"
)
View Source
const (
	UnknownFieldError string = "unknown field"
	NoPrimaryKeyError string = "no primary key in table"
)
View Source
const Version string = "v0.1.0"

Variables

View Source
var TypeMap = map[string]string{
	FieldInt:       "number",
	FieldString:    "string",
	FieldTimestamp: "Date",
}

Functions

func Generate

func Generate()

func MakeDir

func MakeDir(projectPath string) error

func MakeRelativeDir

func MakeRelativeDir(parentDir, dirPath string) error

func MultiRunCmdInDir

func MultiRunCmdInDir(dirPath string, cmds ...Command) error

func RunCmdInDir

func RunCmdInDir(dirPath string, cmd string, args ...string) error

Types

type Command

type Command struct {
	Cmd  string
	Args []string
	Func func()
}

type Config

type Config struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
	Schema  Schema `yaml:"schema"`
}

func Parse

func Parse(configPath string) (Config, error)

type FieldSchema

type FieldSchema struct {
	Name         string `yaml:"name"`
	Type         string `yaml:"type"`
	IsPrimaryKey bool   `yaml:"is_primary_key"`
	HasDefault   bool   `yaml:"has_default"`
}

type Schema

type Schema struct {
	Tables []TableSchema `yaml:"tables"`
}

type TableSchema

type TableSchema struct {
	Name   string        `yaml:"name"`
	Fields []FieldSchema `yaml:"fields"`
}

Jump to

Keyboard shortcuts

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