Skip to content

lazytooo/go-admin-group

This branch is 2025 commits behind GoAdminGroup/go-admin:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

089dcf6 · Aug 1, 2018

History

31 Commits
Jul 24, 2018
Jul 8, 2018
Jul 14, 2018
Jul 24, 2018
Aug 1, 2018
Aug 1, 2018
Jul 14, 2018
Aug 1, 2018
Aug 1, 2018
Aug 1, 2018
Jul 16, 2018
Jul 9, 2018
Jul 17, 2018
Jul 8, 2018
Jul 14, 2018
Aug 1, 2018
Aug 1, 2018
Jul 8, 2018
Jul 11, 2018
Jul 14, 2018
Jul 8, 2018
Jul 13, 2018
Jul 8, 2018
Aug 1, 2018
Jul 14, 2018

Repository files navigation

go-admin

Go Report Card

中文文档

the missing golang admin builder tool.

as a admin platform. the following principle is important as i see.

  • security and easy to use
  • independent of business platform

feature

  • beautiful admin interface builder powerd by adminlte
  • configurable which help manage your database data easily
  • powerful auth manage system
  • writed by go
  • portable
  • easy to deploy

requirements

install

only from source now.

cd $GOPATH/src
git clone https://github.com/chenhg5/go-admin
mv go-admin goAdmin

usage

Step 1 : create a table config file

./goman create --table=user

Step 2 : table config

models/user.go

package models

func GetUserTable() (userTable GlobalTable) {
    
    // 列显示配置
	userTable.Info.FieldList = []FieldStruct{
		{
			Head:     "姓名",
			Field:    "name",
			TypeName: "varchar",
			ExcuFun: func(model RowModel) string {
                return model.Value
            },
		},
		{
			Head:     "性别",
			Field:    "sex",
			TypeName: "tinyint",
			ExcuFun: func(model RowModel) string {
				if model。Value == "1" {
					return "男"
				}
				if model。Value == "2" {
					return "女"
				}
				return "未知"
			},
		},
	}

	userTable.Info.Table = "users"
	userTable.Info.Title = "用户表"
	userTable.Info.Description = "用户表"

    // 表单显示配置
	userTable.Form.FormList = []FormStruct{
		{
			Head:     "姓名",
			Field:    "name",
			TypeName: "varchar",
			Default:  "",
			Editable: true,
			FormType: "default",
		}, {
			Head:     "性别",
			Field:    "sex",
			TypeName: "tinyint",
			Default:  "",
			Editable: true,
			FormType: "text",
		},
	}

	userTable.Form.Table = "users"
	userTable.Form.Title = "用户表"
	userTable.Form.Description = "用户表"

	return
}

Step 3 : route & database config

  • models/global.go
package models

// map下标是路由前缀,对应的值是GlobalTable类型,为表单与表格的数据抽象表示
var GlobalTableList = map[string]GlobalTable{
	"user": GetUserTable(),
}

  • config/config.go
package config

var EnvConfig = map[string]interface{}{

    "SERVER_PORT": ":4003",

	"DATABASE_IP":           "127.0.0.1",
	"DATABASE_PORT":         "3306",
	"DATABASE_USER":         "root",
	"DATABASE_PWD":          "root",
	"DATABASE_NAME":         "goadmin",
	"DATABASE_MAX_IDLE_CON": 50,  // 连接池连接数
	"DATABASE_MAX_OPEN_CON": 150, // 最大连接数

	"REDIS_IP":       "127.0.0.1",
	"REDIS_PORT":     "6379",
	"REDIS_PASSWORD": "",
	"REDIS_DB":       1,
	
	"PORTABLE": false,  // 是否跨平台可移植
	
	"AUTH_DOMAIN": "localhost",
}

Step 4 : import sql

import admin.sql into database

Step 5 : load dependency

make deps

Step 6 : Runit & Enjoy ☕

make

visit http://localhost:4003/login by browser

login with username:admin, password:admin

make command

  • build
  • test
  • clean
  • run
  • restart
  • deps : install dependency
  • cross : cross compile
  • pages : compile html into go file
  • assets : compile assets into go file
  • fmt

powerd by

todo

  • add go-bindata support
  • add more components
  • menu structure
  • rcba auth
  • custom pages
  • combine assets
  • auto install engine
  • demo site
  • performance analysis

contribution

very welcome to pr

here to join into the develop team

QQ Group Num: 756664859

special thanks

inspired by laravel-admin

About

a admin generate tool writed by golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 42.9%
  • CSS 35.3%
  • JavaScript 14.6%
  • Go 7.1%
  • Makefile 0.1%