github.com/snowlyg/iris-admin (go): <h1 align="center">IrisAdmin</h1>  [![Build Status](https://app.travis-ci.com/snowlyg/iris-admin.svg?branch=master)](https://app.travis-ci.com/snowlyg/iris-admin) [![LICENSE](https://img.shields.io/github/license/snowlyg/iris-admin)](https://github.com/snowlyg/iris-admin/blob/master/LICENSE) [![go doc](https://godoc.org/github.com/snowlyg/iris-admin?status.svg)](https://godoc.org/github.com/snowlyg/iris-admin) [![go report](https://goreportcard.com/badge/github.com/snowlyg/iris-admin)](https://goreportcard.com/badge/github.com/snowlyg/iris-admin) [![Build Status](https://codecov.io/gh/snowlyg/iris-admin/branch/master/graph/badge.svg)](https://codecov.io/gh/snowlyg/iris-admin)  [简体中文](./README.md)  | English  #### Project url  [GITHUB](https://github.com/snowlyg/iris-admin) | [GITEE](https://gitee.com/snowlyg/iris-admin) **** > This project just for learning golang, welcome to give your suggestions!  #### Documentation  - [IRIS-ADMIN-DOC](https://doc.snowlyg.com) - [IRIS V12 document for chinese](https://github.com/snowlyg/iris/wiki) - [godoc](https://pkg.go.dev/github.com/snowlyg/iris-admin?utm_source=godoc)  [![Gitter](https://badges.gitter.im/iris-go-tenancy/community.svg)](https://gitter.im/iris-go-tenancy/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Join the chat at https://gitter.im/iris-go-tenancy/iris-admin](https://badges.gitter.im/iris-go-tenancy/iris-admin.svg)](https://gitter.im/iris-go-tenancy/iris-admin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) #### BLOG  - [REST API with iris-go web framework](https://blog.snowlyg.com/iris-go-api-1/)  - [How to user iris-go with casbin](https://blog.snowlyg.com/iris-go-api-2/)  ---  #### Getting started  - Get master package , Notice must use `master` version.  ```sh  ```  #### Program introduction  ##### The project consists of multiple plugins, each with different functions  - [viper_server]  ```go package cache  import (  )  var CONFIG Redis  // getViperConfig get initialize config  db: ` + db + ` addr: "` + CONFIG.Addr + `" password: "` + CONFIG.Password + `" pool-size: ` + poolSize),  ```  - [zap_server]  ```go  ```  - [database]  ```go  ```  - [casbin]  ```go  ```  - [cache]  ```go  ```  - [operation]  - [cron_server]  ```go  ```  - [web]  -  ```go  // WebFunc web framework // - GetTestClient test client // - GetTestLogin test for login // - AddWebStatic add web static path // - AddUploadStatic add upload static path // - Run start  ```  - [mongodb]  #### Initialize database  ##### Simple  - Use gorm's `AutoMigrate()` function to auto migrate database.  ```go package main  import (  )  ```  ##### Custom migrate tools  - Use `gormigrate` third party package. Tt's helpful for database migrate and program development. - Detail is see  [iris-admin-cmd](https://github.com/snowlyg/iris-admin-example/blob/main/iris/cmd/main.go).  ---  - Add main.go file.  ```go package main  import (  )  ```  #### Run project  - When you first run this cmd `go run main.go` , you can see some config files in  the `config` directory, - and `rbac_model.conf` will be created in your project root directory.  ```sh go run main.go ```  #### Module  - You can use [iris-admin-rbac](https://github.com/snowlyg/iris-admin-rbac) package to add rbac function for your project quickly. - Your can use AddModule() to add other modules .  ```go package main  import (  )  ```  #### Default static file path  - A static file access path has been built in by default - Static files will upload to `/static/upload` directory. - You can set this config key `static-path` to change the default directory.  ```yaml system:  ```  #### Use with front-end framework , e.g. vue  - Default,you must build vue to the `dist` directory. - Naturally you can set this config key `web-path` to change the default directory.  ```go package main  import (  )  ```  #### Example  - [iris](https://github.com/snowlyg/iris-admin-example/tree/main/iris) - [gin](https://github.com/snowlyg/iris-admin-example/tree/main/gin)  #### RBAC  - [iris-admin-rbac](https://github.com/snowlyg/iris-admin-rbac)  #### Unit test and documentation  - Before start unit tests, you need to set two system environment variables `mysqlPwd` and `mysqlAddr`,that will be used when running the test instance。 - helper/tests(https://github.com/snowlyg/helper/tree/main/tests) package the unit test used, it's  simple package base on httpexpect/v2(https://github.com/gavv/httpexpect). - [example for unit test](https://github.com/snowlyg/iris-admin-rbac/tree/main/iris/perm/tests) - [example for unit test](https://github.com/snowlyg/iris-admin-rbac/tree/main/gin/authority/test)  Before create a http api unit test , you need create a base test file named `main_test.go` , this file have some unit test step ： ***Suggest use docker mysql, otherwise if the test fails, there will be a lot of test data left behind*** - 1.create database before test start and delete database when test finish. - 2.create tables and seed test data at once time. - 3.`PartyFunc` and `SeedFunc` use to custom someting for your test model. 内容如下所示: ***main_test.go***  ```go package test  import (  )  var TestServer *web_gin.WebServer var TestClient *httptest.Client  ```  ***index_test.go***  ```go package test  import (  )  var (  )  ```  ## 🔋 JetBrains OS licenses  <a href="https://www.jetbrains.com/?from=iris-admin" target="_blank"><img src="https://raw.githubusercontent.com/panjf2000/illustrations/master/jetbrains/jetbrains-variant-4.png" width="230" align="middle"/></a>  ## ☕️ Buy me a coffee  > Please be sure to leave your name, GitHub account or other social media accounts when you donate by the following means so that I can add it to the list of donors as a token of my appreciation. - [为爱发电](https://afdian.net/@snowlyg/plan) - [donating](https://paypal.me/snowlyg?country.x=C2&locale.x=zh_XC)
Keywords: apidoc|casbin|docker|docker-compose|excel|gin|go|golang|gorm|httptest|iris|iris-api|redis