# go-admin **Repository Path**: cxlcxlcxl/go-admin ## Basic Information - **Project Name**: go-admin - **Description**: go-admin是基于golang快速搭建可视化数据管理后台的框架 - **Primary Language**: Go - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: https://www.go-admin.cn - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 436 - **Created**: 2020-01-10 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

go-admin

遗失的Golang语言编写的数据可视化与管理平台构建框架

Go Report Card Go Report Card golang telegram qq群 GoDoc license

laravel-admin启发

## 前言 GoAdmin 可以帮助你的golang应用快速实现数据可视化,搭建一个数据管理平台。 demo: [https://demo.go-admin.cn](https://demo.go-admin.cn) 账号:admin 密码:admin demo代码: https://github.com/GoAdminGroup/demo.go-admin.cn ![](http://file.go-admin.cn/introduction/interface_2.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). ## 使用 通过以下三步运行: ### 第一步:导入 sql [mysql](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.sql) [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
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: "godmin", 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, } // Generators: 详见 https://github.com/GoAdminGroup/go-admin/blob/master/examples/datamodel/tables.go adminPlugin := admin.NewAdmin(datamodel.Generators) // 增加 chartjs 组件 template.AddComp(chartjs.NewChart()) // 增加 generator, 第一个参数是对应的访问路由前缀 // 例子: // // "user" => http://localhost:9033/admin/info/user // // adminPlugin.AddGenerator("user", datamodel.GetUserTable) // 自定义首页 r.GET("/admin", func(ctx *gin.Context) { eng.Content(ctx, func(ctx interface{}) (types.Panel, error) { return datamodel.GetContent() }) }) _ = eng.AddConfig(cfg).AddPlugins(adminPlugin).Use(r) _ = r.Run(":9033") } ```

其他框架的例子: [https://github.com/GoAdminGroup/go-admin/tree/master/examples](https://github.com/GoAdminGroup/go-admin/tree/master/examples) ### 第三步:运行 ```shell GO111MODULE=on go run main.go ``` 访问:[http://localhost:9033/admin](http://localhost:9033/admin) 更多细节详见 [文档说明](http://www.go-admin.cn/docs/#/README) [这里一个超级简单上手的例子](https://github.com/GoAdminGroup/example) ## 贡献 [这里有一份贡献指南](CONTRIBUTING_CN.md) 非常欢迎提pr,这里可以加入开发小组 QQ群:756664859,记得备注加群来意 这里是[开发计划](https://github.com/GoAdminGroup/go-admin/projects) [点击这里加微信群](http://quick.go-admin.cn/resource/wechat_qrcode.jpg) ## 十分感谢 inspired by [laravel-admin](https://github.com/z-song/laravel-admin) ## 打赏 留下您的github/gitee用户名,我们将会展示在[捐赠名单](DONATION.md)中。