Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socketio #109

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .air.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tmp_dir = "tmp"

[build]
# Just plain old shell command. You could use `make` as well.
cmd = "wire gen ./internal/app/injector && swag init --generalInfo ./internal/app/swagger.go --output ./internal/app/swagger && go build -o ./cmd/gin-admin/gin-admin ./cmd/gin-admin"
cmd = "wire gen ./internal/app && go build -o ./cmd/gin-admin/gin-admin ./cmd/gin-admin"
# Binary file yields from `cmd`.
bin = "./cmd/gin-admin/gin-admin"
# Customize binary.
Expand All @@ -19,7 +19,7 @@ log = "air_errors.log"
# Watch these filename extensions.
include_ext = ["go", "toml"]
# Ignore these filename extensions or directories.
exclude_dir = ["assets", "tmp", "data", "docs", "scripts", "vendor", "internal/app/swagger"]
exclude_dir = ["assets", "tmp", "data", "docs", "scripts", "vendor", "internal/app/swagger" ,"internal/app/test"]
# Ignore files
exclude_file = ["internal/app/wire_gen.go"]
# There's no necessary to trigger build each time file changes if it's too frequency.
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
/data
/internal/app/test/data
/tmp
/vendor


# IDE configs
.idea
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Lyric
Copyright (c) 2021 Lyric

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ build:
@go build -ldflags "-w -s -X main.VERSION=$(RELEASE_TAG)" -o $(SERVER_BIN) ./cmd/${APP}

start:
go run -ldflags "-X main.VERSION=$(RELEASE_TAG)" ./cmd/${APP}/main.go web -c ./configs/config.toml -m ./configs/model.conf --menu ./configs/menu.yaml
@go run -ldflags "-X main.VERSION=$(RELEASE_TAG)" ./cmd/${APP}/main.go web -c ./configs/config.toml -m ./configs/model.conf --menu ./configs/menu.yaml

swagger:
swag init --generalInfo ./cmd/${APP}/main.go --output ./internal/app/swagger
@swag init --parseDependency --generalInfo ./cmd/${APP}/main.go --output ./internal/app/swagger

wire:
wire gen ./internal/app
@wire gen ./internal/app

test:
@go test -v $(shell go list ./...)
cd ./internal/app/test && go test -v

clean:
rm -rf data release $(SERVER_BIN) internal/app/test/data cmd/${APP}/data
Expand Down
79 changes: 64 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

</div>

- [在线演示地址](http://139.129.88.71:10088) (用户名:root,密码:abc-123)(`温馨提醒:为了达到更好的演示效果,这里给出了拥有最高权限的用户,请手下留情,只操作自己新增的数据,不要动平台本身的数据!谢谢!`)
- [Swagger 文档地址](http://139.129.88.71:10088/swagger/index.html)

## 特性

- 遵循 `RESTful API` 设计规范 & 基于接口的编程规范
Expand Down Expand Up @@ -66,46 +63,98 @@ $ go run cmd/gin-admin/main.go web -c ./configs/config.toml -m ./configs/model.c

## 生成`swagger`文档

```
```bash
# 基于Makefile
make swagger

# OR 使用swag命令
swag init --generalInfo ./cmd/${APP}/main.go --output ./internal/app/swagger
swag init --parseDependency --generalInfo ./cmd/${APP}/main.go --output ./internal/app/swagger
```

## 重新生成依赖注入文件

```
```bash
# 基于Makefile
make wire

# OR 使用wire命令
wire gen ./internal/app
```

## [gin-admin-cli](https://github.com/gin-admin/gin-admin-cli) 工具使用

### 创建项目

```bash
gin-admin-cli new -d test-gin-admin -p test-gin-admin -m
```

### 快速生成业务模块

#### 创建模板 task.yaml

```bash
name: Task
comment: 任务管理
fields:
- name: Code
type: string
comment: 任务编号
required: true
binding_options: ""
gorm_options: "size:50;index;"
- name: Name
type: string
comment: 任务名称
required: true
binding_options: ""
gorm_options: "size:50;index;"
- name: Memo
type: string
comment: 任务备注
required: false
binding_options: ""
gorm_options: "size:1024;"
```

#### 执行生成命令并运行

```bash
cd test-gin-admin
gin-admin-cli g -d . -p test-gin-admin -f ./task.yaml

# 生成 swagger
make swagger

# 生成依赖项
make wire

# 运行服务
make start
```

## 前端工程

- 基于[Ant Design React](https://ant.design/index-cn)版本的实现:[gin-admin-react](https://github.com/gin-admin/gin-admin-react)(也可使用国内源:[https://gitee.com/lyric/gin-admin-react](https://gitee.com/lyric/gin-admin-react))

## 互动交流
## Questions

### 与作者对话
### OSX 下基于 `sqlite3` 运行出现:`'stdlib.h' file not found`

> 该项目是利用业余时间进行开发的,开发思路主要是源于自己的项目积累及个人思考,如果您有更好的想法和建议请与我进行沟通,一起探讨,畅聊技术人生,相互学习,一起进步。我非常期待!下面是我的微信二维码(如果此项目对您提供了帮助也可以请作者喝杯咖啡 (\* ̄︶ ̄),聊表心意,一起星巴克「续杯」~嘿嘿 ):
```bash
export CGO_ENABLED=1; export CC=gcc; go get -v -x github.com/mattn/go-sqlite3
```

## 互动交流

<div>
<img src="http://store.tiannianshou.com/screenshots/gin-admin/wechat.jpeg" width="256"alt="wechat" />
<img src="http://store.tiannianshou.com/screenshots/gin-admin/we-pay.png" width="256" alt="we-pay" />
</div>

### QQ 群:1409099

<img src="http://store.tiannianshou.com/screenshots/gin-admin/qqgroup.jpeg" width="256" alt="qqgroup" />
</div>

## MIT License

Copyright (c) 2020 Lyric
Copyright (c) 2021 Lyric

[reportcard-url]: https://goreportcard.com/report/github.com/LyricTian/gin-admin
[reportcard-image]: https://goreportcard.com/badge/github.com/LyricTian/gin-admin
Expand Down
54 changes: 20 additions & 34 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,57 +1,43 @@
module github.com/LyricTian/gin-admin/v7

go 1.14
go 1.15

require (
github.com/LyricTian/captcha v1.1.0
github.com/LyricTian/gzip v0.1.1
github.com/LyricTian/queue v1.2.0
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/casbin/casbin/v2 v2.4.1
github.com/casbin/casbin/v2 v2.11.3
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/fatih/camelcase v1.0.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/gin-contrib/cors v1.3.1
github.com/gin-gonic/gin v1.6.3
github.com/go-openapi/spec v0.19.7 // indirect
github.com/go-openapi/swag v0.19.9 // indirect
github.com/go-redis/redis v6.15.7+incompatible
github.com/go-openapi/spec v0.20.3 // indirect
github.com/go-redis/redis v6.15.9+incompatible
github.com/go-redis/redis_rate v6.5.0+incompatible
github.com/go-sql-driver/mysql v1.5.0 // indirect
github.com/golang/protobuf v1.4.1 // indirect
github.com/google/gops v0.3.8
github.com/google/uuid v1.1.1
github.com/google/gops v0.3.12
github.com/google/uuid v1.1.2
github.com/google/wire v0.4.0
github.com/googollee/go-socket.io v1.6.0
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a
github.com/jinzhu/gorm v1.9.12
github.com/jinzhu/now v1.1.1 // indirect
github.com/json-iterator/go v1.1.9
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
github.com/jinzhu/gorm v1.9.16
github.com/json-iterator/go v1.1.10
github.com/koding/multiconfig v0.0.0-20171124222453-69c27309b2d7
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.5.2 // indirect
github.com/mailru/easyjson v0.7.1 // indirect
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/onsi/ginkgo v1.12.0 // indirect
github.com/onsi/gomega v1.10.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-sqlite3 v1.14.6 // indirect
github.com/pkg/errors v0.9.1
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sirupsen/logrus v1.6.0
github.com/stretchr/testify v1.5.1
github.com/stretchr/testify v1.6.1
github.com/swaggo/gin-swagger v1.2.0
github.com/swaggo/swag v1.6.5
github.com/swaggo/swag v1.7.0
github.com/tidwall/buntdb v1.1.2
github.com/tidwall/gjson v1.6.0 // indirect
github.com/tidwall/pretty v1.0.1 // indirect
github.com/urfave/cli/v2 v2.2.0
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 // indirect
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f // indirect
golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f // indirect
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1
golang.org/x/tools v0.0.0-20200511202723-1762287ae9dd // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v2 v2.2.8
github.com/urfave/cli/v2 v2.3.0
golang.org/x/net v0.0.0-20210326220855-61e056675ecf // indirect
golang.org/x/sys v0.0.0-20210326220804-49726bf1d181 // indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
golang.org/x/tools v0.1.0 // indirect
gopkg.in/yaml.v2 v2.4.0
)
Loading