gen

package
v1.8.90 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const NullPackage = "\"gopkg.in/guregu/null.v3\""

NullPackage is the package name used for handling nulls

Variables

This section is empty.

Functions

func BuildPermissionsGoFile added in v1.8.20

func BuildPermissionsGoFile(permissionMap map[string]string)

func BuildTypescriptPermissions added in v1.8.11

func BuildTypescriptPermissions(permissionMap map[string]string) string

BuildTypescriptPermissions returns a formatted typescript file of permission constants

func CleanGoDALs

func CleanGoDALs(dir, interfacesDir string, schemas []*schema.Schema) (e error)

CleanGoDALs removes any repo files that aren't in the database.Tables map

func CleanGoModels

func CleanGoModels(dir string, tsDir string, tables map[string]struct{}) (e error)

CleanGoModels removes model files that are not found in the database.Tables map

func ColumnMapToNames added in v1.8.89

func ColumnMapToNames(columns map[string]string) []string

func FetchAllPermissionsFromControllers added in v1.8.82

func FetchAllPermissionsFromControllers(controllersDir string) (map[string]string, error)

func GenAPIDocs added in v1.8.89

func GenAPIDocs(config *lib.Config, routes *lib.RoutesJSONContainer)

func GenAppBootstrapFile added in v1.8.90

func GenAppBootstrapFile(basePackage string) error

GenAppBootstrapFile generates the services bootstrap file

func GenControllerBootstrap added in v1.8.89

func GenControllerBootstrap(basePackageName string, dirs []string) string

GenControllerBootstrap generates the bootstrap file for the applications controllers

func GenDALs

func GenDALs(dalsDir, dalInterfacesDir string, config *lib.Config, force, clean bool) error

func GenGoPerms added in v1.8.20

func GenGoPerms(config *lib.Config) (e error)

func GenInterface

func GenInterface(comment, pkgName, ifaceName, ifaceComment string, methods []string, imports []string) ([]byte, error)

GenInterface takes makes the interface into a byte array

func GenInterfaces

func GenInterfaces(srcDir, destDir string) error

func GenModels

func GenModels(config *lib.Config, force bool, clean bool) error

GenModels generates models

func GenRoutesAndPermissions added in v1.8.19

func GenRoutesAndPermissions(controllers []*lib.Controller, dirs []string, config *lib.Config) error

GenRoutes generates a list of routes from a directory of controller files

func GenTSPerms added in v1.8.20

func GenTSPerms(config *lib.Config) (e error)

func GenTSRoutes added in v1.8.89

func GenTSRoutes(controllers []*lib.Controller, config *lib.Config) error

func GenerateDALsBootstrapFile

func GenerateDALsBootstrapFile(config *lib.Config, dir string, schemaList *schema.SchemaList) error

GenerateDALsBootstrapFile generates a dal bootstrap file in golang

func GenerateGoDAL

func GenerateGoDAL(config *lib.Config, table *schema.Table, dir string) (e error)

GenerateGoDAL returns a string for a repo in golang

func GenerateGoModel

func GenerateGoModel(packageName, dir string, schemaName string, table *schema.Table) (e error)

GenerateGoModel returns a string for a model in golang

func GenerateTypescriptDTO added in v1.8.89

func GenerateTypescriptDTO(name string, columns map[string]string) (string, error)

GenerateTypescriptType returns a string for a type in typescript TODO need a map of all types so that import paths can be used for struct and array types TODO test for struct types (apart from array types)

func GenerateTypescriptModel added in v1.8.89

func GenerateTypescriptModel(name string, columns map[string]string) (string, error)

GenerateTypescriptType returns a string for a type in typescript

func GenerateTypescriptModels added in v1.8.89

func GenerateTypescriptModels(config *lib.Config, routes *lib.RoutesJSONContainer) error

GenerateTypescriptModels returns a string for a typscript types file

func GenerateTypesriptDTOs added in v1.8.89

func GenerateTypesriptDTOs(config *lib.Config, routes *lib.RoutesJSONContainer) error

func ImportString added in v1.8.89

func ImportString(sb io.Writer, parts []string)

func ImportStrings added in v1.8.89

func ImportStrings(sb io.Writer, columns map[string]string)

func InheritStrings added in v1.8.89

func InheritStrings(sb io.Writer, columns map[string]string) []string

func LoadPermissionsFromJSON added in v1.8.34

func LoadPermissionsFromJSON() map[string]string

LoadPermissionsFromJSON loads a set of permissions from a JSON file

func LoadRoutes added in v1.8.89

func LoadRoutes(config *lib.Config) (*lib.RoutesJSONContainer, error)

func ParseFileToGoStruct added in v1.8.89

func ParseFileToGoStruct(filePath string) (*lib.GoStruct, error)

InspectFile inspects a file

func TSFileHeader added in v1.8.89

func TSFileHeader(sb io.Writer, name string)

Types

type Gen

type Gen struct {
	Config *lib.Config
}

Gen conntains all of the generator functionality

func (*Gen) GenerateDALSQL

func (g *Gen) GenerateDALSQL(dir string, database *schema.Schema) (e error)

GenerateDALSQL generates a constants file filled with sql statements

func (*Gen) GetOrphanedDals

func (g *Gen) GetOrphanedDals(dir string, database *schema.Schema) []string

GetOrphanedDals gets repo files that aren't in the database.Tables map

type TSRouteGenerator added in v1.8.89

type TSRouteGenerator struct {
	// contains filtered or unexported fields
}

func NewTSRouteGenerator added in v1.8.89

func NewTSRouteGenerator(c *lib.Controller) *TSRouteGenerator

func (*TSRouteGenerator) AddImport added in v1.8.89

func (t *TSRouteGenerator) AddImport(importType string)

type TypescriptGenerator added in v1.8.89

type TypescriptGenerator struct {
	// contains filtered or unexported fields
}

func NewTypescriptGenerator added in v1.8.89

func NewTypescriptGenerator(config *lib.Config, routes *lib.RoutesJSONContainer) *TypescriptGenerator

func (*TypescriptGenerator) ExtractColumns added in v1.8.89

func (tg *TypescriptGenerator) ExtractColumns(goType string) map[string]string

func (*TypescriptGenerator) GenerateTypescriptAggregate added in v1.8.89

func (tg *TypescriptGenerator) GenerateTypescriptAggregate(name string) (string, error)

GenerateTypescriptAggregate returns a string for a type in typescript

func (*TypescriptGenerator) GenerateTypescriptDefaults added in v1.8.89

func (tg *TypescriptGenerator) GenerateTypescriptDefaults(sb io.Writer, objectName string)

func (*TypescriptGenerator) GenerateTypescriptFields added in v1.8.89

func (tg *TypescriptGenerator) GenerateTypescriptFields(sb io.Writer, objectName string)

func (*TypescriptGenerator) GenerateTypesriptAggregates added in v1.8.89

func (tg *TypescriptGenerator) GenerateTypesriptAggregates(config *lib.Config) error

Jump to

Keyboard shortcuts

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