language

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Golang = Language{
	Name:     "golang",
	Template: golangModelTemplate,
	Types:    map[string]string{},
	Funcs: template.FuncMap{
		"Type": type2string,
		"Tag":  tag2string,
	},
	Formatter: rewrite.CleanImportsWriteGolangFile,
	Importter: genGoImports,
	Packager:  genNameSpace,
	ExtName:   ".go",
}

Golang represents a golang language

Functions

func GetGolangTemplate

func GetGolangTemplate(name string, funcs template.FuncMap) *template.Template

func GetPresetTemplate added in v0.9.1

func GetPresetTemplate(name string) *template.Template

func NewTemplate added in v0.3.1

func NewTemplate(name, content string, funcs template.FuncMap) *template.Template

func RegisterLanguage

func RegisterLanguage(l *Language)

RegisterLanguage registers a language

Types

type Formatter

type Formatter func(fileName string, sourceCode []byte) ([]byte, error)

type Importter

type Importter func(tables map[string]*schemas.Table) map[string]string

type Language

type Language struct {
	Name      string
	ExtName   string
	Template  string
	Types     map[string]string
	Funcs     template.FuncMap
	Formatter Formatter
	Importter Importter
	Packager  Packager
}

Language represents a languages supported when reverse codes

func GetLanguage

func GetLanguage(name string) *Language

GetLanguage returns a language if exists

func (*Language) FixTarget

func (l *Language) FixTarget(target *config.ReverseTarget)

type Packager

type Packager func(targetDir string) string

Jump to

Keyboard shortcuts

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