本文整理匯總了Golang中github.com/trdata/easyjson/jlexer.Lexer類的典型用法代碼示例。如果您正苦於以下問題:Golang Lexer類的具體用法?Golang Lexer怎麽用?Golang Lexer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Lexer類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: UnmarshalFromReader
// UnmarshalFromReader reads all the data in the reader and decodes as JSON into the object.
func UnmarshalFromReader(r io.Reader, v Unmarshaler) error {
data, err := ioutil.ReadAll(r)
if err != nil {
return err
}
l := jlexer.Lexer{Data: data}
v.UnmarshalEasyJSON(&l)
return l.Error()
}
示例2: UnmarshalEasyJSON
// UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
func (v *Int32) UnmarshalEasyJSON(l *jlexer.Lexer) {
if l.IsNull() {
l.Skip()
*v = Int32{}
} else {
v.V = l.Int32()
v.Defined = true
}
}
示例3: UnmarshalEasyJSON
// UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
func (v *Optional) UnmarshalEasyJSON(l *jlexer.Lexer) {
if l.IsNull() {
l.Skip()
*v = Optional{}
} else {
v.V = l.Optional()
v.Defined = true
}
}
示例4: UnmarshalEasyJSON
// UnmarshalEasyJSON does JSON unmarshaling using easyjson interface.
func (v *Uint64) UnmarshalEasyJSON(l *jlexer.Lexer) {
if l.IsNull() {
l.Skip()
*v = Uint64{}
} else {
v.V = l.Uint64()
v.Defined = true
}
}
示例5: UnmarshalJSON
// MarshalJSON implements a standard json marshaler interface.
func (v *Int32) UnmarshalJSON(data []byte) error {
l := jlexer.Lexer{}
v.UnmarshalEasyJSON(&l)
return l.Error()
}
示例6: Unmarshal
// Unmarshal decodes the JSON in data into the object.
func Unmarshal(data []byte, v Unmarshaler) error {
l := jlexer.Lexer{Data: data}
v.UnmarshalEasyJSON(&l)
return l.Error()
}