node.go 804 B

123456789101112131415161718192021222324252627282930
  1. package dto
  2. import (
  3. "github.com/gin-gonic/gin"
  4. )
  5. type AddNodeInput struct {
  6. Name string `form:"name" json:"name" comment:"服务器名称" validate:"required"`
  7. Host string `form:"host" json:"host" comment:"服务器IP" validate:""`
  8. Port int `form:"port" json:"port" comment:"端口" validate:""`
  9. Url string `form:"url" json:"url" comment:"更换服务器地址" validate:"required"`
  10. }
  11. func (params *AddNodeInput) BindingValidParams(c *gin.Context) error {
  12. if err := c.ShouldBind(params); err != nil {
  13. return err
  14. }
  15. return nil
  16. }
  17. type RemoveNodeInput struct {
  18. Host string `form:"host" json:"host" comment:"host" validate:"required"`
  19. }
  20. func (params *RemoveNodeInput) BindingValidParams(c *gin.Context) error {
  21. if err := c.ShouldBind(params); err != nil {
  22. return err
  23. }
  24. return nil
  25. }