internal

package
v0.0.0-...-11b9b78 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const BASE_PATH = "templates/base"
View Source
const RESOURCE_PATH = "templates/resource"
View Source
const ROUTER_PATH_ENDPOINTS = "templates/router/endpoints.go.tmpl"
View Source
const ROUTER_PATH_IMPORTS = "templates/router/imports.go.tmpl"
View Source
const TFG_FILENAME string = "tfg.yml"
View Source
const TFG_VERSION string = "0.0.1"

Variables

This section is empty.

Functions

func ConfigureDatabase

func ConfigureDatabase(cfg *GlobalConfig) error

func ConfigureDatabaseForUpdate

func ConfigureDatabaseForUpdate(cfg *GlobalConfig) error

func CreateNewProject

func CreateNewProject(cfg *GlobalConfig) error

func ExecuteTemplatesBase

func ExecuteTemplatesBase(cfg *GlobalConfig) error

func ExecuteTemplatesResources

func ExecuteTemplatesResources(cfg *GlobalConfig, useUpdating bool) error

func FormatProject

func FormatProject(cfg *GlobalConfig) error

func GoModDownloadProject

func GoModDownloadProject(cfg *GlobalConfig) error

func RemoveAll

func RemoveAll(cfg *GlobalConfig) error

func TidyProject

func TidyProject(cfg *GlobalConfig) error

func UpdateProject

func UpdateProject(cfg *GlobalConfig) error

func UpdateRouter

func UpdateRouter(tables []*TableDefinition, cfg *GlobalConfig) error

Types

type ColumnDefinition

type ColumnDefinition struct {
	Name         string `yaml:"name"`
	Type         string `yaml:"type"`
	Nullable     bool   `yaml:"nullable"`
	IsPrimaryKey bool   `yaml:"is_primary_key"`
	HasDefault   bool   `yaml:"has_default"`
	TableName    string `yaml:"-"`
}

func (*ColumnDefinition) GoName

func (c *ColumnDefinition) GoName() string

func (*ColumnDefinition) GoType

func (c *ColumnDefinition) GoType() string

func (*ColumnDefinition) NameNoSpaces

func (c *ColumnDefinition) NameNoSpaces() string

func (*ColumnDefinition) NameNoSpacesForDb

func (c *ColumnDefinition) NameNoSpacesForDb() string

func (*ColumnDefinition) ParserFunc

func (c *ColumnDefinition) ParserFunc() string

func (*ColumnDefinition) VarName

func (c *ColumnDefinition) VarName() string

type DatabaseConfig

type DatabaseConfig struct {
	Type           string             `mapstructure:"db_type" yaml:"type"`
	Host           string             `mapstructure:"db_host" yaml:"host"`
	Port           string             `mapstructure:"db_port" yaml:"port"`
	Database       string             `mapstructure:"db_database" yaml:"database"`
	Schema         string             `mapstructure:"db_schema" yaml:"schema"`
	User           string             `mapstructure:"db_user" yaml:"-"`
	Password       string             `mapstructure:"db_pass" yaml:"-"`
	SSL            string             `mapstructure:"db_ssl" yaml:"ssl"`
	Tables         []*TableDefinition `yaml:"tables"`
	UpdatingTables []*TableDefinition `yaml:"-"`
}

func (*DatabaseConfig) ConnectionString

func (d *DatabaseConfig) ConnectionString() string

type GlobalConfig

type GlobalConfig struct {
	ConfigFile     string          `yaml:"-"`
	Version        string          `yaml:"version"`
	ProjectConfig  *ProjectConfig  `yaml:"project"`
	DatabaseConfig *DatabaseConfig `yaml:"database"`
}

func ReadFlagsConfig

func ReadFlagsConfig(projectName string) (*GlobalConfig, error)

func ReadYamlConfig

func ReadYamlConfig(projectRelPath string) (*GlobalConfig, error)

type ProjectConfig

type ProjectConfig struct {
	Name       string `mapstructure:"project_name" yaml:"name"`
	Base       string `mapstructure:"project_base" yaml:"base"`
	ProjectDir string `yaml:"-"`
}

type ResourceParams

type ResourceParams struct {
	ProjectConfig *ProjectConfig
	Table         *TableDefinition
}

type TableDefinition

type TableDefinition struct {
	Name    string              `yaml:"name"`
	Columns []*ColumnDefinition `yaml:"columns"`
}

func (*TableDefinition) ColumnsByComma

func (t *TableDefinition) ColumnsByComma() string

func (*TableDefinition) CreateInputByComma

func (t *TableDefinition) CreateInputByComma() string

func (*TableDefinition) CreateInputColumns

func (t *TableDefinition) CreateInputColumns() []*ColumnDefinition

func (*TableDefinition) CreateInputNumbersByComma

func (t *TableDefinition) CreateInputNumbersByComma() string

func (*TableDefinition) CreateInputParams

func (t *TableDefinition) CreateInputParams() string

func (*TableDefinition) InputName

func (t *TableDefinition) InputName() string

func (*TableDefinition) ModelScanParams

func (t *TableDefinition) ModelScanParams() string

func (*TableDefinition) PluralName

func (t *TableDefinition) PluralName() string

func (*TableDefinition) PrimaryKeys

func (t *TableDefinition) PrimaryKeys() []*ColumnDefinition

func (*TableDefinition) PrimaryKeysByCommaVars

func (t *TableDefinition) PrimaryKeysByCommaVars() string

func (*TableDefinition) PrimaryKeysEndpoint

func (t *TableDefinition) PrimaryKeysEndpoint() string

func (*TableDefinition) PrimaryKeysFuncParams

func (t *TableDefinition) PrimaryKeysFuncParams() string

func (*TableDefinition) PrimaryKeysWhereClause

func (t *TableDefinition) PrimaryKeysWhereClause() string

func (*TableDefinition) SingularName

func (t *TableDefinition) SingularName() string

func (*TableDefinition) UpdateClause

func (t *TableDefinition) UpdateClause() string

func (*TableDefinition) UpdateInputByComma

func (t *TableDefinition) UpdateInputByComma() string

func (*TableDefinition) UpdateInputColumns

func (t *TableDefinition) UpdateInputColumns() []*ColumnDefinition

func (*TableDefinition) UpdateInputParams

func (t *TableDefinition) UpdateInputParams() string

type UpdateRouterParams

type UpdateRouterParams struct {
	ProjectConfig *ProjectConfig
	Tables        []*TableDefinition
}

Jump to

Keyboard shortcuts

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