model.go 601 B

123456789101112131415161718192021222324252627282930
  1. package model
  2. import "fmt"
  3. const (
  4. _statFmt = "heartbeat_in_%s_%d"
  5. )
  6. // ErrReport def
  7. type ErrReport struct {
  8. MobiApp string `form:"mobi_app" validate:"required"`
  9. Build int64 `form:"build" validate:"required"`
  10. Ecode int `form:"error_code" validate:"required"`
  11. }
  12. // SuccReport def
  13. type SuccReport struct {
  14. MobiApp string `json:"mobi_app"`
  15. Build int64 `json:"build"`
  16. }
  17. // ToProm def.
  18. func (v *SuccReport) ToProm() string {
  19. return fmt.Sprintf(_statFmt, v.MobiApp, v.Build)
  20. }
  21. // ToProm def.
  22. func (v *ErrReport) ToProm() string {
  23. return fmt.Sprintf(_statFmt, v.MobiApp, v.Build)
  24. }