codegen

package
v1.6.7 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GenerateDefinerTemplate = "attrs_definer.tmpl"
	GenerateModelsTemplate  = "models_interface.tmpl"
	GenerateAdminTemplate   = "admin_setup.tmpl"
)

Variables

View Source
var (
	Prefixes = map[string]string{
		GenerateDefinerTemplate: "godjango_definer",
		GenerateModelsTemplate:  "godjango_models",
		GenerateAdminTemplate:   "godjango_admin",
	}
)

Functions

This section is empty.

Types

type Choice

type Choice struct {
	Name  string
	Value string
}

type Choices

type Choices struct {
	Name    string
	Choices []Choice
}

type CodeGenerator

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

func (*CodeGenerator) BuildTemplateObject

func (c *CodeGenerator) BuildTemplateObject(schema *plugin.Schema) *TemplateObject

func (*CodeGenerator) Render

func (c *CodeGenerator) Render(w io.Writer, name string, obj *TemplateObject) error

type CodeGeneratorOptions

type CodeGeneratorOptions struct {
	Initialisms           []string          `json:"initialisms"`
	Rename                map[string]string `json:"rename"`
	PackageName           string            `json:"package"`
	InflectionExclusions  []string          `json:"inflection_exclusions"`
	OutFile               string            `json:"out"`
	GenerateAdminSetup    bool              `json:"generate_admin_setup"`
	GenerateModelsMethods bool              `json:"generate_models_methods"`
	// contains filtered or unexported fields
}

func (*CodeGeneratorOptions) GoName

func (c *CodeGeneratorOptions) GoName(name string) string

func (*CodeGeneratorOptions) InflectSingular

func (s *CodeGeneratorOptions) InflectSingular(name string) string

type Field

type Field struct {
	Name                         string
	ColumnName                   string
	Null                         bool
	Blank                        bool
	ReadOnly                     bool
	Primary                      bool
	Choices                      string
	RelatedObjectName            string
	RelatedObjectPackage         string
	RelatedObjectPackageAdressor string
	GoType                       string
}

type Struct

type Struct struct {
	Name               string
	PluralName         string
	PrimaryField       Field
	PrimaryFieldColumn string
	TableName          string
	Fields             []Field
	InsertableFields   []Field
}

type TemplateObject

type TemplateObject struct {
	PackageName string
	SQLCVersion string
	Structs     []*Struct
	Choices     []*Choices
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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