github.com/bububa/oceanengine/marketing-api@v0.0.0-20210315120513-0b953137f7a6/model/track/response.go (about)

     1  package track
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  type Response struct {
     8  	Code int    `json:"code,omitempty"`
     9  	Msg  string `json:"msg,omitempty"`
    10  	Ret  int    `json:"ret,omitempty"`
    11  }
    12  
    13  func (r Response) IsError() bool {
    14  	return r.Code != 0
    15  }
    16  
    17  func (r Response) Error() string {
    18  	return fmt.Sprintf("%d:%s", r.Code, r.Msg)
    19  }