Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rym-util
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhengqiuyun
rym-util
Commits
c4db0a51
Commit
c4db0a51
authored
Aug 10, 2022
by
zhengqiuyun86
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
初始化
parent
7db34074
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
go.mod
go.mod
+0
-1
go.sum
go.sum
+0
-0
main.go
main.go
+9
-1
router.go
router/router.go
+2
-9
No files found.
go.mod
View file @
c4db0a51
...
@@ -7,7 +7,6 @@ require (
...
@@ -7,7 +7,6 @@ require (
github.com/go-playground/validator/v10 v10.11.0
github.com/go-playground/validator/v10 v10.11.0
github.com/go-redis/redis v6.15.9+incompatible
github.com/go-redis/redis v6.15.9+incompatible
github.com/olivere/elastic/v7 v7.0.32
github.com/olivere/elastic/v7 v7.0.32
github.com/swaggo/gin-swagger v1.5.2
gorm.io/driver/mysql v1.2.2
gorm.io/driver/mysql v1.2.2
gorm.io/gorm v1.22.4
gorm.io/gorm v1.22.4
)
)
...
...
go.sum
View file @
c4db0a51
This diff is collapsed.
Click to expand it.
main.go
View file @
c4db0a51
package
main
package
main
import
(
import
(
"fmt"
"git.168cad.top/zhengqiuyun/rym-util/es"
"git.168cad.top/zhengqiuyun/rym-util/es"
"git.168cad.top/zhengqiuyun/rym-util/log"
"git.168cad.top/zhengqiuyun/rym-util/mysqlrym"
"git.168cad.top/zhengqiuyun/rym-util/mysqlrym"
"git.168cad.top/zhengqiuyun/rym-util/redis"
"git.168cad.top/zhengqiuyun/rym-util/redis"
"git.168cad.top/zhengqiuyun/rym-util/router"
"git.168cad.top/zhengqiuyun/rym-util/router"
...
@@ -11,5 +13,11 @@ func main() {
...
@@ -11,5 +13,11 @@ func main() {
mysqlrym
.
TestLog
()
mysqlrym
.
TestLog
()
es
.
TestLog
()
es
.
TestLog
()
redis
.
TestLog
()
redis
.
TestLog
()
router
.
InitGinEngine
()
c
:=
router
.
InitGinEngine
()
portAddr
:=
fmt
.
Sprintf
(
":%d"
,
8080
)
log
.
Info
(
fmt
.
Sprintf
(
"web start in port%s"
,
portAddr
))
err
:=
c
.
Run
(
portAddr
)
if
err
!=
nil
{
panic
(
err
)
}
}
}
router/router.go
View file @
c4db0a51
package
router
package
router
import
(
import
(
"git.168cad.top/zhengqiuyun/rym-util/conf"
"git.168cad.top/zhengqiuyun/rym-util/router/validator"
"git.168cad.top/zhengqiuyun/rym-util/router/validator"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
swaggerFiles
"github.com/swaggo/files"
"github.com/gin-gonic/gin/render"
"github.com/swaggo/gin-swagger"
"net/http"
"net/http"
)
)
...
@@ -14,14 +12,9 @@ func InitGinEngine() *gin.Engine {
...
@@ -14,14 +12,9 @@ func InitGinEngine() *gin.Engine {
c
:=
gin
.
New
()
c
:=
gin
.
New
()
//便于工具监测
//便于工具监测
c
.
GET
(
"/favicon.ico"
,
func
(
c
*
gin
.
Context
)
{
c
.
GET
(
"/favicon.ico"
,
func
(
c
*
gin
.
Context
)
{
c
.
JSON
(
http
.
StatusOK
,
nil
)
c
.
Render
(
http
.
StatusOK
,
render
.
String
{}
)
})
})
//自定义验证器
//自定义验证器
validator
.
RegisterValidate
()
validator
.
RegisterValidate
()
if
conf
.
Env
==
"dev"
||
conf
.
Env
==
"test"
{
//swagger
c
.
GET
(
"/swagger/*any"
,
ginSwagger
.
WrapHandler
(
swaggerFiles
.
Handler
))
}
return
c
return
c
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment