codegen

package
v0.0.0-...-4b2ec8c Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DtoTemplate = `` /* 3135-byte string literal not displayed */

Variables

View Source
var BlackList = []string{"Queries"}

Functions

func CrudGen

func CrudGen(dataMetas DataMetas, destDir string, imports []string) error

func GetPackageName

func GetPackageName(filePath string) (string, error)

GetPackageName reads a *.go file from the given file path and returns the package name

func GroupStructMetas

func GroupStructMetas(structMetas []*StructMeta) ([]*StructMeta, StructMetasMap, error)

func RunCodeGen

func RunCodeGen(sourceDir string, destDir string, imports []string) error

Types

type DataMeta

type DataMeta struct {
	Package     string     `json:"package"`
	DestPackage string     `json:"dest_package"`
	Imports     []string   `json:"imports"`
	PlainModel  StructMeta `json:"plain_model"`
	CreateModel StructMeta `json:"create_model"`
	UpdateModel StructMeta `json:"update_model"`
}

func Map2DataMetas

func Map2DataMetas(groupedStructMetaMap StructMetasMap) []*DataMeta

type DataMetas

type DataMetas = []*DataMeta

type FieldMeta

type FieldMeta struct {
	Name string `json:"name"`
	Type string `json:"type"`
	Tag  string `json:"tag"`
}

type StructMeta

type StructMeta struct {
	Name       string       `json:"name"`
	FieldMetas []*FieldMeta `json:"field_meta"`
	Package    string       `json:"package"`
}

func CollectStructMetas

func CollectStructMetas(dir string) ([]*StructMeta, error)

type StructMetasMap

type StructMetasMap = map[string][]*StructMeta

Jump to

Keyboard shortcuts

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