github.com/cloudwego/dynamicgo@v0.2.6-0.20240519101509-707f41b6b834/testdata/kitex_gen/example2/json.go (about)

     1  package example2
     2  
     3  import (
     4  	"encoding/json"
     5  	"strconv"
     6  )
     7  
     8  func (v *BasePartial) MarshalJSON() ([]byte, error) {
     9  	if v == nil || v.TrafficEnv == nil {
    10  		return []byte("null"), nil
    11  	}
    12  	b, e := json.Marshal(v.TrafficEnv)
    13  	return []byte(strconv.Quote(string(b))), e
    14  }