mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-23 01:57:55 +08:00
update the README code annotations, make it more clear
This commit is contained in:
parent
e51d726b33
commit
47a973a90e
@ -908,12 +908,13 @@ func main() {
|
|||||||
r.GET("/someProtoBuf", func(c *gin.Context) {
|
r.GET("/someProtoBuf", func(c *gin.Context) {
|
||||||
reps := []int64{int64(1), int64(2)}
|
reps := []int64{int64(1), int64(2)}
|
||||||
label := "test"
|
label := "test"
|
||||||
|
// The specific definition of protobuf is written in the testdata/protoexample file.
|
||||||
// Proto specifically defines the testdata/protoexample file
|
|
||||||
data := &protoexample.Test{
|
data := &protoexample.Test{
|
||||||
Label: &label,
|
Label: &label,
|
||||||
Reps: reps,
|
Reps: reps,
|
||||||
}
|
}
|
||||||
|
// Note that data becomes binary data in the response
|
||||||
|
// Will output protoexample.Test protobuf serialized data
|
||||||
c.ProtoBuf(http.StatusOK, data)
|
c.ProtoBuf(http.StatusOK, data)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user