新Sir

导航

 

2022年5月6日

摘要: hello.proto syntax = "proto3";package helloproto;message Student { string name = 1; bool male = 2; repeated int32 scores = 3;} 命令 protoc --go_out=. he 阅读全文
posted @ 2022-05-06 15:52 新Sir 阅读(77) 评论(0) 推荐(0) 编辑
 
摘要: package main import ( "io" "net/http" "net/rpc" "net/rpc/jsonrpc" ) type HelloService struct { } func (p *HelloService) Hello(request string, reply *s 阅读全文
posted @ 2022-05-06 15:21 新Sir 阅读(82) 评论(0) 推荐(0) 编辑
 
摘要: rpc服务端 package main import ( "log" "net" "net/rpc" "net/rpc/jsonrpc" ) type HelloService struct { } func (p *HelloService) Hello(request string, reply 阅读全文
posted @ 2022-05-06 14:40 新Sir 阅读(88) 评论(0) 推荐(0) 编辑
 
摘要: 简单的中间件 权限认证 demo func JWTAuthMiddleware() func(c *gin.Context) { return func(c *gin.Context) { staffName := c.Request.Header.Get("staff_name") stafEma 阅读全文
posted @ 2022-05-06 09:51 新Sir 阅读(261) 评论(0) 推荐(0) 编辑
 
摘要: 背景:给予gin 框架的服务,想写一个中间件,保存操作信息到数据库。 字段包括请求的数据,也就是需要获取 请求参数中的body,、 像这样, appGp.POST("delAddAdministrator", middlewares.LogMiddleWare, api.DelAddAdminist 阅读全文
posted @ 2022-05-06 09:35 新Sir 阅读(553) 评论(0) 推荐(0) 编辑