First time , very thanks for iris framework and developer to helps~
Now talk something , this library just resolve a small and simple problem :
My trust 99% golang uses people need this
Wait long time not has , start with me , but i time and ability is small and limited !
So I'm just use i familiar technology :
- iris
- xorm
- casbin -> rbac
- react -> ant.design
Hope to help everyone !
Install
go get https://github.com/23233/simple_admin
Examples -> https://github.com/23233/simple_admin/tree/master/_examples
Ready -> Defined you struct
type TestModelA struct {
Id uint64 `xorm:"autoincr pk unique" json:"id"`
Name string `xorm:"varchar(20)"`
}
type TestModelB struct {
Id uint64 `xorm:"autoincr pk unique" json:"id"`
Desc string `xorm:"varchar(60)"`
}
Ready -> Defined you xorm engine
Engine, err = xorm.NewEngine("mysql", dbUrl)
Ready -> Defined iris application
app := iris.New()
Go -> Register simple_admin
modelList := []interface{}{new(TestModelA), new(TestModelB)}
_, err := simple_admin.New(simple_admin.Config{
Engine: engine,
App: app,
ModelList: modelList,
Name: "app name",
RunSync: true, // this is xorm sync2
Prefix: "/admin", // path prefix like app.Prefix("/admin")
})
Go -> Run you app open browser http://127.0.0.1:8080/admin Yes god job
app.Listen(":8080")
first, now don't support xormdelete use Unscoped methods!deleted
tag- the best you do not use custom usermodel , admin isolation is good!
example: sp("key:value") sp("key(value)") sp("key('value')")
- autogen -> mark columns is code auto generate not handle
sp("autogen")
- lineTo -> if custom action , default value use this define for select row
sp("lineTo(Id)")
- fk -> foreign key , support one to tone and many to one , if use multiple is many to one , just only support id columns , must be have id field !!!
sp("fk('ComplexModelC')")
sp("fk('ComplexModelC') multiple")
- tag -> front show whats ? now support custom tag , default show text , options: img
sp:"tag(img)"
- SpInsertBefore
- SpInsertAfter
- SpUpdateBefore
- SpUpdateAfter
- SpDeleteBefore()
- SpDeleteAfter()
- func name must use SpAction , just like SpAction() SpAction123() is ok , must return simple_admin.CustomAction struct !
- [] full test
- [] gorm support
- [] gin support
- dashboard
- simple event monitor
- add spider visit monitor options enable!
- custom action
- [] fine permission manage
- [] support micro frontend , use qiankun
- [] beat more features