Jump to content
彼岸论坛
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[Go 编程语言] 有没有什么优雅的方法实现 当 req.xx == yy 时 某些参数必须 或转成其他 struct


Recommended Posts

Posted

一个 api 中转系统

当 body json channel==app1 时,data.somekey required 。否则 [必须不传]

其他类似 channel=app2 时 data.somekey2 required 否则 [必须不传]

现在是这么干的

type tmp struct { C string json:"channel" }

gin.get("/", func... c.bind(C) switch(channel) case xx: return new ChannelXX(c.req)

  • 游客注册

    游客注册

  • Members

    No members to show

  • Recent Status Updates

    No Recent Status Updates
  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...