codegen

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: MIT Imports: 9 Imported by: 1

Documentation

Overview

Package codegen 简单的代码生成工具

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(path string, content []byte, mode fs.FileMode) error

Dump 格式化并输出 Go 源码到 path

func DumpFromTemplate

func DumpFromTemplate(path, tpl string, data any, mode fs.FileMode) error

DumpFromTemplate 根据模板内容生成代码

func DumpFromTemplateFile

func DumpFromTemplateFile(path string, tplFile string, data any, mode fs.FileMode) error

DumpFromTemplateFile 根据 tplFile 指向的模板内容生成代码

func GoDefine added in v0.12.0

func GoDefine(t reflect.Type, m map[reflect.Type]string, unexported bool) string

GoDefine 返回对象 v 在 Go 源码中的定义方式

对于结构类型会自动展开。

t 需要转换的类型; m 需要特殊定义的类型; unexported 是否导出小写字段;

Types

This section is empty.

Jump to

Keyboard shortcuts

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