gencommon

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: MIT Imports: 23 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRootAppPath

func BuildRootAppPath(appRepository string) (string, error)

func CreatePathAndFileFromTemplateString

func CreatePathAndFileFromTemplateString(path []string, content string, templateVar TemplateVar) error

func CreateRootAppPath

func CreateRootAppPath(rootAppPath string) error

func FmtNewContent

func FmtNewContent(content string) (string, error)

func GenerateAuthorizeNewCode

func GenerateAuthorizeNewCode(content string, templateVar TemplateVar) (string, error)

func GenerateCertificates

func GenerateCertificates(rootAppPath string) error

func GenerateFromTemplateFile

func GenerateFromTemplateFile(templatePath string, templateVar TemplateVar) (string, error)

func GenerateFromTemplateString

func GenerateFromTemplateString(content string, templateVar TemplateVar) (string, error)

func GenerateMigrateNewCode

func GenerateMigrateNewCode(content string, templateVar TemplateVar) (string, error)

func GeneratePathAndFileFromTemplateString

func GeneratePathAndFileFromTemplateString(path []string, content string, templateVar TemplateVar) error

func GenerateRoutesNewCode

func GenerateRoutesNewCode(content string, templateVar TemplateVar) (string, error)

func HandlePathInfo

func HandlePathInfo(path []string) (string, string)

func NotifyNewApp

func NotifyNewApp(rootAppPath string)

func SecureRandom

func SecureRandom(size int) string

func UpdateMigrate

func UpdateMigrate(basePath string, templateVar TemplateVar)

Types

type AppConfig

type AppConfig struct {
	AppName                        string     `yaml:"app_name"`
	AppRepository                  string     `yaml:"app_repository"`
	SecretKey                      string     `yaml:"secret_key"`
	ResetPasswordExpirationSeconds int        `yaml:"reset_password_expiration_seconds"`
	ResetPasswordUrl               string     `yaml:"reset_password_url"`
	TokenExpirationSeconds         int        `yaml:"token_expiration_seconds"`
	Pagination                     Pagination `yaml:"pagination"`
	Locales                        []string   `yaml:"locales"`
}

func GetAppConfig

func GetAppConfig() (AppConfig, error)

type EntityColumn

type EntityColumn struct {
	Name                string
	NameSnakeCase       string
	NameSnakeCasePlural string
	Type                string
	Extras              string
	IsRelation          bool
	IsForeignKey        bool
	MigrateType         string
	MigrateExtra        string
}

func GetColumnInfo

func GetColumnInfo(columnName string, columnType string, extra string) EntityColumn

type EntityName

type EntityName struct {
	CamelCase            string
	CamelCasePlural      string
	LowerCamelCase       string
	LowerCamelCasePlural string
	SnakeCase            string
	SnakeCasePlural      string
	LowerCase            string
}

func SetEntityName

func SetEntityName(name string) EntityName

type MigrationMetadata

type MigrationMetadata struct {
	Type          string
	Name          string
	Version       string
	FileNameSufix string
	Entity        string
}

func SetMigrationMetadata

func SetMigrationMetadata(name string) MigrationMetadata

type Pagination added in v1.3.0

type Pagination struct {
	Default int `yaml:"default"`
	Maximum int `yaml:"maximum"`
}

type TemplateVar

type TemplateVar struct {
	AppRepository     string
	AppName           string
	SecretKey         string
	Database          string
	EntityName        EntityName
	EntityColumns     []EntityColumn
	MigrationMetadata MigrationMetadata
}

Jump to

Keyboard shortcuts

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