gosword

package module
v2.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 19 Imported by: 0

README

Go-sword 利刃 V2.0.0

GitHub last commit GitHub GitHub repo size GitHub stars GitHub forks

一款基于Go语言的可视化web管理后台生成工具包 根据MySQL的表结构,创建CRUD的管理后台界面,开发者无需再重复手动的创建具有CRUD能力的页面,只需要点击按钮即可生成完整的管理后台

官网 https://sunshinev.github.io/go-sword-home/

详细请参阅文档 文档 https://go-sword-doc.osinger.com/

59384a43cbc382dec53dd76d169a5d001587995174.jpg

  1. 首先下拉选择MySQL 的表格,然后点击Preview按钮,即可渲染出需要创建的文件
  2. 首次创建新项目文件需要点击select all全部选择,首次创建包含了项目启动必需的核心文件
  3. 点击Generate按钮,既可以看到提示文件创建成功
  4. 到目前为止,我们的后台已经创建成功了

注意:

  1. 首次创建,文件需要全部选择
  2. 如果创建第二个管理页面,那么可以只选择 select diff & new按钮,然后点击Generate按钮
  3. 每次生成新的管理界面后,请重启新创建的项目

管理后台效果

  1. 后端报错提醒
  2. 增加、删除、编辑、列表、批量删除、分页、检索

1626ee1d3300ac6db6669d63721d96381587996351.jpg

列表

ea1f86ebc1b5c88aaf6484fa078584951587997286.jpg

删除

70279af696d9a230001f821cdf3a1ac21587997368.jpg

预览

2d1871a645acc3d3544ad7f77a0d6fca1587997398.jpg

编辑

a9255db26b2af0365655840f6afd27851587997440.jpg

Go-sword fork

如果想要自定义的话,那么需要注意,Go-sword 项目可以打包成一个那单独的命令来执行,因为将所有的静态文件也进行了打包

静态文件压缩命令如下:

go-bindata -o assets/resource/dist.go -pkg resource resource/dist/...
go-bindata -o assets/stub/stub.go -pkg stub stub/...
go-bindata -o assets/view/view.go -pkg view view/...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInstance

type FileInstance struct {
	FileName       string `json:"file_name"`
	FilePath       string `json:"file_path"`
	FileContent    string `json:"file_content"`
	FileOldContent string `json:"file_old_content"`
	IsDiff         bool   `json:"is_diff"`
	IsNew          bool   `json:"is_new"`
}

type GenerateParams

type GenerateParams struct {
	TableName string   `json:"table_name"`
	Files     []string `json:"files"`
}

type Generator

type Generator struct {
	Columns         []string
	ColumnDataTypes map[string]string
	Struc           string
	PackageName     string
	StructName      string
	TableName       string
	// Files need to generate
	FileList []*FileInstance

	// Generate files list
	GFileList []*FileInstance
	// contains filtered or unexported fields
}

func (*Generator) Generate

func (s *Generator) Generate(table string, files []string)

func (Generator) Init

func (s Generator) Init() *Generator

func (*Generator) Preview

func (s *Generator) Preview(table string)

type List

type List struct {
	List interface{} `json:"list"`
}

type Ret

type Ret struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

type Sword

type Sword struct {
}

func Init

func Init(configFile string) *Sword

func (*Sword) Generate

func (s *Sword) Generate(w http.ResponseWriter, r *http.Request) error

func (*Sword) Preview

func (s *Sword) Preview(w http.ResponseWriter, r *http.Request) error

func (*Sword) Render

func (s *Sword) Render(writer http.ResponseWriter, request *http.Request) error

func (*Sword) Run

func (s *Sword) Run()

func (*Sword) Welcome

func (s *Sword) Welcome()

Directories

Path Synopsis
assets
resource
Code generated for package resource by go-bindata DO NOT EDIT.
Code generated for package resource by go-bindata DO NOT EDIT.
stub
Code generated by go-bindata.
Code generated by go-bindata.
view
Code generated for package view by go-bindata DO NOT EDIT.
Code generated for package view by go-bindata DO NOT EDIT.

Jump to

Keyboard shortcuts

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