遗失的Golang编写的数据可视化与管理平台构建框架
## 前言 GoAdmin 可以帮助你的golang应用快速实现数据可视化,搭建一个数据管理平台。 [文档](http://doc.go-admin.cn/zh) | [论坛](http://discuss.go-admin.com) | [Demo](https://demo.go-admin.cn) | [上手例子](https://github.com/GoAdminGroup/example/blob/master/README_CN.md) | [GoAdmin+vue 例子](https://github.com/GoAdminGroup/goadmin-vue-example) ![](http://file.go-admin.cn/introduction/interface_3.png) ## 特征 - 🚀 **高生产效率**: 10分钟内做一个好看的管理后台 - 🎨 **主题**: 默认为adminlte,更多好看的主题正在制作中,欢迎给我们留言 - 🔢 **插件化**: 提供插件使用,真正实现一个插件解决不了问题,那就两个 - ✅ **认证**: 开箱即用的rbac认证系统 - ⚙️ **框架支持**: 支持大部分框架接入,让你更容易去上手和扩展 ## 翻译 我们需要您的帮忙: [https://github.com/GoAdminGroup/docs/issues/1](https://github.com/GoAdminGroup/docs/issues/1) ## 谁在使用GoAdmin [评论这个issue告诉我们](https://github.com/GoAdminGroup/go-admin/issues/71). ## 使用 提示:现在你也可以这样做。 ```shell $ mkdir new_project && cd new_project $ go install github.com/GoAdminGroup/go-admin/adm $ adm init -l cn ``` 或者:(使用v1.2.16的adm) ```shell $ mkdir new_project && cd new_project $ go install github.com/GoAdminGroup/go-admin/adm $ adm init web -l cn ``` 通过以下三步运行: ### 第一步:导入 sql - [mysql](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.sql) - [mssql](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.mssql) - [postgresql](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.pgsql) - [sqlite](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.db) ### 第二步:创建 main.go```go package main import ( "github.com/gin-gonic/gin" _ "github.com/GoAdminGroup/go-admin/adapter/gin" _ "github.com/GoAdminGroup/go-admin/modules/db/drivers/mysql" "github.com/GoAdminGroup/go-admin/engine" "github.com/GoAdminGroup/go-admin/plugins/admin" "github.com/GoAdminGroup/themes/adminlte" "github.com/GoAdminGroup/go-admin/modules/config" "github.com/GoAdminGroup/go-admin/template" "github.com/GoAdminGroup/go-admin/template/chartjs" "github.com/GoAdminGroup/go-admin/template/types" "github.com/GoAdminGroup/go-admin/examples/datamodel" "github.com/GoAdminGroup/go-admin/modules/language" ) func main() { r := gin.Default() eng := engine.Default() // global config cfg := config.Config{ Databases: config.DatabaseList{ "default": { Host: "127.0.0.1", Port: "3306", User: "root", Pwd: "root", Name: "goadmin", MaxIdleCon: 50, MaxOpenCon: 150, Driver: "mysql", }, }, UrlPrefix: "admin", // STORE 必须设置且保证有写权限,否则增加不了新的管理员用户 Store: config.Store{ Path: "./uploads", Prefix: "uploads", }, Language: language.CN, // 开发模式 Debug: true, // 日志文件位置,需为绝对路径 InfoLogPath: "/var/logs/info.log", AccessLogPath: "/var/logs/access.log", ErrorLogPath: "/var/logs/error.log", ColorScheme: adminlte.ColorschemeSkinBlack, } // 增加 chartjs 组件 template.AddComp(chartjs.NewChart()) _ = eng.AddConfig(&cfg). AddGenerators(datamodel.Generators). // 增加 generator, 第一个参数是对应的访问路由前缀 // 例子: // // "user" => http://localhost:9033/admin/info/user // AddGenerator("user", datamodel.GetUserTable). Use(r) // 自定义首页 eng.HTML("GET", "/admin", datamodel.GetContent) _ = r.Run(":9033") } ```