本文整理汇总了Golang中github.com/mailru/easyjson/jwriter.Writer.Raw方法的典型用法代码示例。如果您正苦于以下问题:Golang Writer.Raw方法的具体用法?Golang Writer.Raw怎么用?Golang Writer.Raw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/mailru/easyjson/jwriter.Writer
的用法示例。
在下文中一共展示了Writer.Raw方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: MarshalEasyJSON
// MarshalEasyJSON does JSON marshaling using easyjson interface.
func (v *RawMessage) MarshalEasyJSON(w *jwriter.Writer) {
if len(*v) == 0 {
w.RawString("null")
} else {
w.Raw(*v, nil)
}
}
示例2: easyjson_encode_github_com_buger_jsonparser_benchmark_MediumPayload
func easyjson_encode_github_com_buger_jsonparser_benchmark_MediumPayload(out *jwriter.Writer, in *MediumPayload) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"person\":")
if in.Person == nil {
out.RawString("null")
} else {
(*in.Person).MarshalEasyJSON(out)
}
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"company\":")
out.RawByte('{')
v8_first := true
for v8_name, v8_value := range in.Company {
if !v8_first {
out.RawByte(',')
}
v8_first = false
out.String(v8_name)
out.Raw(json.Marshal(v8_value))
}
out.RawByte('}')
out.RawByte('}')
}
示例3: easyjson7f5ba663EncodeGithubComSergeiSvistunovGorpcDebug
func easyjson7f5ba663EncodeGithubComSergeiSvistunovGorpcDebug(out *jwriter.Writer, in debug.Debug) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"modules\":")
if in.Modules == nil {
out.RawString(`null`)
} else {
out.RawByte('{')
v2First := true
for v2Name, v2Value := range in.Modules {
if !v2First {
out.RawByte(',')
}
v2First = false
out.String(string(v2Name))
out.RawByte(':')
out.Raw(json.Marshal(v2Value))
}
out.RawByte('}')
}
out.RawByte('}')
}
示例4: easyjson_encode_go_serialization_benchmarks_A
func easyjson_encode_go_serialization_benchmarks_A(out *jwriter.Writer, in *A) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"Name\":")
out.String(in.Name)
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"BirthDay\":")
out.Raw((in.BirthDay).MarshalJSON())
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"Phone\":")
out.String(in.Phone)
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"Siblings\":")
out.Int(in.Siblings)
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"Spouse\":")
out.Bool(in.Spouse)
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"Money\":")
out.Float64(in.Money)
out.RawByte('}')
}
示例5: easyjson7f5ba663EncodeGithubComSergeiSvistunovGorpcTransportHttpJson
func easyjson7f5ba663EncodeGithubComSergeiSvistunovGorpcTransportHttpJson(out *jwriter.Writer, in httpSessionResponse) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"result\":")
out.String(string(in.Result))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"data\":")
if d, ok := in.Data.(json.Marshaler); ok {
out.Raw(d.MarshalJSON())
} else {
out.Raw(json.Marshal(in.Data))
}
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"error\":")
out.String(string(in.Error))
if in.Debug != nil {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"debug\":")
if in.Debug == nil {
out.RawString("null")
} else {
easyjson7f5ba663EncodeGithubComSergeiSvistunovGorpcDebug(out, *in.Debug)
}
}
out.RawByte('}')
}