generator

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFunc

func AddFunc(name string, f interface{})

func ParseTemplate

func ParseTemplate(templateContent string, data Domain) (string, error)

ParseTemplate 模板解析

Types

type Definition

type Definition struct {
	TableName         string            `yaml:"table_name,omitempty"`
	WithoutCreateTime bool              `yaml:"without_create_time,omitempty"`
	WithoutUpdateTime bool              `yaml:"without_update_time,omitempty"`
	SoftDelete        bool              `yaml:"soft_delete,omitempty"`
	Fields            []DefinitionField `yaml:"fields,omitempty"`
}

type DefinitionField

type DefinitionField struct {
	Name string `yaml:"name,omitempty"`
	Type string `yaml:"type,omitempty"`
	Tag  string `yaml:"tag,omitempty"`
}

type Domain

type Domain struct {
	Imports     []string `yaml:"imports,omitempty"`
	PackageName string   `yaml:"package,omitempty"`
	Models      []Model  `yaml:"models,omitempty"`
	Meta        Meta     `yaml:"meta,omitempty"`
}

func (Domain) Init

func (dom Domain) Init() Domain

type DomainContext

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

func (DomainContext) Register

func (d DomainContext) Register()

type Meta

type Meta struct {
	TablePrefix string `yaml:"table_prefix"`
}

type Model

type Model struct {
	Name       string     `yaml:"name,omitempty"`
	Relations  []Relation `yaml:"relations,omitempty"`
	Definition Definition `yaml:"definition,omitempty"`
}

type Relation

type Relation struct {
	Model string `yaml:"model,omitempty"`
	Rel   string `yaml:"rel,omitempty"`

	ForeignKey string `yaml:"foreign_key,omitempty"`
	OwnerKey   string `yaml:"owner_key,omitempty"`
	LocalKey   string `yaml:"local_key,omitempty"`

	PivotTable string `yaml:"table,omitempty"`

	Package string `yaml:"package,omitempty"`
	Method  string `yaml:"method,omitempty"`
}

func (Relation) ImportPackages

func (rel Relation) ImportPackages() []string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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