代码拉取完成,页面将自动刷新
Used Swagger UI
// IRouteBuilder app.UseEndpoints(...)
endpoints.UseSwaggerDoc(rb,
swagger.Info{
Title: "YoyoGO 框架文档演示",
Version: "v1.0.0",
Description: "框架文档演示swagger文档 v1.0 [ #yoyogo](https://github.com/yoyofx/yoyogo).",
TermsOfService: "https://dev.yoyogo.run",
Contact: swagger.Contact{
Email: "zl.hxd@hotmail.com",
Name: "yoyogo",
},
License: swagger.License{
Name: "MIT",
Url: "https://opensource.org/licenses/MIT",
},
},
func(openapi *swagger.OpenApi) {
openapi.AddSecurityBearerAuth()
})
// mvc controller
```golang
// DocumentResponse custom document response
type DocumentResponse struct {
Message string `json:"message" doc:"消息"`
List []DocumentDto `json:"list" doc:"文档列表"`
Success bool `json:"success" doc:"是否成功"`
}
func (controller UserController) GetDocumentList(request *struct {
mvc.RequestGET `route:"/v1/user/doc/list" doc:"获取全部文档列表"`
}) DocumentResponse {
return DocumentResponse{Message: "GetDocumentList", List: []DocumentDto{
{Id: 1, Name: "test1", Time: time.Now()}, {Id: 2, Name: "test2", Time: time.Now()},
{Id: 3, Name: "test3", Time: time.Now()}, {Id: 4, Name: "test4", Time: time.Now()},
{Id: 5, Name: "test5", Time: time.Now()}, {Id: 6, Name: "test6", Time: time.Now()},
}, Success: true}
}
截止此版本,go二进制漏洞已全部修复,请放心使用.
env: ${CUSTOM_ENV}
profile:
dns: ${REMOTE_HOST}
ip: ${REMOTE_IP:10.0.1.12}
namespace: ${MYNAMESPACE:space.localhost}
type Profile struct {
DNS string `config:"dns"`
IP string `config:"ip"`
NS string `config:"namespace"`
}
config := abstractions.NewConfigurationBuilder().
AddEnvironment().
AddYamlFile("config").Build()
config.GetConfigObject("profile", &profile)
assert.Equal(t, profile.NS, "space.yoyogo.run")
assert.Equal(t, profile.DNS, "my host")
assert.Equal(t, profile.IP, "10.0.1.12")
or
env := config.Get("env")
dns := config.Get("profile.dns")
ip := config.Get("profile.ip")
assert.Equal(t, env, "my env variable")
assert.Equal(t, dns, "my host")
assert.Equal(t, ip, "10.0.1.12")
go runtime upgrade 1.18
1.action parameters mapping functions
2.action parameters mapping functions v2
3.mixed bindings.
4.添加本地配置对象
5.优化dockerfile
add session store by redis
fixed bugs:
fixed the concurrency problem of session with cookies.
1.captcha
2.session
1.add endpoint readiness and liveness
2.mvc, find action by http method and action name