本文整理汇总了Golang中github.com/pquerna/ffjson/fflib/v1.FFLexer.CaptureField方法的典型用法代码示例。如果您正苦于以下问题:Golang FFLexer.CaptureField方法的具体用法?Golang FFLexer.CaptureField怎么用?Golang FFLexer.CaptureField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pquerna/ffjson/fflib/v1.FFLexer
的用法示例。
在下文中一共展示了FFLexer.CaptureField方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: UnmarshalJSONFFLexer
//.........这里部分代码省略.........
}
/* handler: tmp_uj__VP type=render.AgentRender kind=struct quoted=false*/
{
if tok == fflib.FFTok_null {
state = fflib.FFParse_after_value
goto mainparse
}
err = tmp_uj__VP.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key)
if err != nil {
return err
}
state = fflib.FFParse_after_value
}
uj.VP = append(uj.VP, tmp_uj__VP)
wantVal = false
}
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_BG:
/* handler: uj.BG type=colour.RGB256 kind=struct quoted=false*/
{
/* Falling back. type=colour.RGB256 kind=struct */
tbuf, err := fs.CaptureField(tok)
if err != nil {
return fs.WrapErr(err)
}
err = json.Unmarshal(tbuf, &uj.BG)
if err != nil {
return fs.WrapErr(err)
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_CpPreyPop:
/* handler: uj.CpPreyPop type=string kind=string quoted=false*/
{
{
if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
}
}
if tok == fflib.FFTok_null {
} else {
outBuf := fs.Output.Bytes()
uj.CpPreyPop = string(string(outBuf))
示例2: UnmarshalJSONFFLexer
//.........这里部分代码省略.........
} else {
uj.Service = string(fs.Output.String())
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_SubService:
/* handler: uj.SubService type=string kind=string */
{
{
if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
}
}
if tok == fflib.FFTok_null {
} else {
uj.SubService = string(fs.Output.String())
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_Metric:
/* handler: uj.Metric type=float64 kind=float64 */
{
if tok != fflib.FFTok_double && tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for float64", tok))
}
}
{
if tok == fflib.FFTok_null {
} else {
tval, err := fflib.ParseFloat(fs.Output.Bytes(), 64)
if err != nil {
return fs.WrapErr(err)
}
uj.Metric = float64(tval)
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_Tags:
/* handler: uj.Tags type=map[string]string kind=map */
{
/* Falling back. type=map[string]string kind=map */
tbuf, err := fs.CaptureField(tok)
if err != nil {
return fs.WrapErr(err)
}
err = json.Unmarshal(tbuf, &uj.Tags)
if err != nil {
return fs.WrapErr(err)
}
}
state = fflib.FFParse_after_value
goto mainparse
wantedvalue:
return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
wrongtokenerror:
return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
tokerror:
if fs.BigError != nil {
return fs.WrapErr(fs.BigError)
}
err = fs.Error.ToError()
if err != nil {
return fs.WrapErr(err)
}
panic("ffjson-generated: unreachable, please report bug.")
done:
return nil
}
示例3: UnmarshalJSONFFLexer
//.........这里部分代码省略.........
handle_Location:
/* handler: uj.Location type=string kind=string quoted=false*/
{
{
if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
}
}
if tok == fflib.FFTok_null {
} else {
outBuf := fs.Output.Bytes()
uj.Location = string(string(outBuf))
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_Locations:
/* handler: uj.Locations type=[]struct { Name string "json:\"libelleLieu\"" } kind=slice quoted=false*/
{
/* Falling back. type=[]struct { Name string "json:\"libelleLieu\"" } kind=slice */
tbuf, err := fs.CaptureField(tok)
if err != nil {
return fs.WrapErr(err)
}
err = json.Unmarshal(tbuf, &uj.Locations)
if err != nil {
return fs.WrapErr(err)
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_HTML:
/* handler: uj.HTML type=string kind=string quoted=false*/
{
{
if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
}
}
if tok == fflib.FFTok_null {
} else {
outBuf := fs.Output.Bytes()
uj.HTML = string(string(outBuf))
示例4: UnmarshalJSONFFLexer
//.........这里部分代码省略.........
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
}
}
{
if tok == fflib.FFTok_null {
} else {
tmpb := fs.Output.Bytes()
if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
uj.Terminated = true
} else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
uj.Terminated = false
} else {
err = errors.New("unexpected bytes for true/false value")
return fs.WrapErr(err)
}
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_Signum:
/* handler: uj.Signum type=interface {} kind=interface quoted=false*/
{
/* Falling back. type=interface {} kind=interface */
tbuf, err := fs.CaptureField(tok)
if err != nil {
return fs.WrapErr(err)
}
err = json.Unmarshal(tbuf, &uj.Signum)
if err != nil {
return fs.WrapErr(err)
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_Expired:
/* handler: uj.Expired type=bool kind=bool quoted=false*/
{
if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for bool", tok))
}
}
{
if tok == fflib.FFTok_null {
} else {
tmpb := fs.Output.Bytes()
if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
uj.Expired = true
} else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
uj.Expired = false
} else {
err = errors.New("unexpected bytes for true/false value")
return fs.WrapErr(err)
}
}
}
state = fflib.FFParse_after_value
goto mainparse
wantedvalue:
return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
wrongtokenerror:
return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
tokerror:
if fs.BigError != nil {
return fs.WrapErr(fs.BigError)
}
err = fs.Error.ToError()
if err != nil {
return fs.WrapErr(err)
}
panic("ffjson-generated: unreachable, please report bug.")
done:
return nil
}
示例5: UnmarshalJSONFFLexer
//.........这里部分代码省略.........
handle_ID:
/* handler: uj.ID type=string kind=string quoted=false*/
{
{
if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
}
}
if tok == fflib.FFTok_null {
} else {
outBuf := fs.Output.Bytes()
uj.ID = string(string(outBuf))
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_Name:
/* handler: uj.Name type=struct { First string "json:\"first\""; Lower string "json:\"first_lower\"" } kind=struct quoted=false*/
{
/* Falling back. type=struct { First string "json:\"first\""; Lower string "json:\"first_lower\"" } kind=struct */
tbuf, err := fs.CaptureField(tok)
if err != nil {
return fs.WrapErr(err)
}
err = json.Unmarshal(tbuf, &uj.Name)
if err != nil {
return fs.WrapErr(err)
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_FactionID:
/* handler: uj.FactionID type=string kind=string quoted=false*/
{
{
if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
}
}
if tok == fflib.FFTok_null {
} else {
outBuf := fs.Output.Bytes()
uj.FactionID = string(string(outBuf))
示例6: UnmarshalJSONFFLexer
//.........这里部分代码省略.........
goto mainparse
handle_ID:
/* handler: uj.ID type=int kind=int quoted=false*/
{
if tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok))
}
}
{
if tok == fflib.FFTok_null {
} else {
tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64)
if err != nil {
return fs.WrapErr(err)
}
uj.ID = int(tval)
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_Created:
/* handler: uj.Created type=time.Time kind=struct quoted=false*/
{
if tok == fflib.FFTok_null {
state = fflib.FFParse_after_value
goto mainparse
}
tbuf, err := fs.CaptureField(tok)
if err != nil {
return fs.WrapErr(err)
}
err = uj.Created.UnmarshalJSON(tbuf)
if err != nil {
return fs.WrapErr(err)
}
state = fflib.FFParse_after_value
}
state = fflib.FFParse_after_value
goto mainparse
handle_Ends:
/* handler: uj.Ends type=time.Time kind=struct quoted=false*/
{
if tok == fflib.FFTok_null {
state = fflib.FFParse_after_value
goto mainparse
}
tbuf, err := fs.CaptureField(tok)
if err != nil {
return fs.WrapErr(err)
}
err = uj.Ends.UnmarshalJSON(tbuf)
if err != nil {
return fs.WrapErr(err)
}
state = fflib.FFParse_after_value
}
state = fflib.FFParse_after_value
goto mainparse
wantedvalue:
return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
wrongtokenerror:
return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
tokerror:
if fs.BigError != nil {
return fs.WrapErr(fs.BigError)
}
err = fs.Error.ToError()
if err != nil {
return fs.WrapErr(err)
}
panic("ffjson-generated: unreachable, please report bug.")
done:
return nil
}
示例7: UnmarshalJSONFFLexer
//.........这里部分代码省略.........
} else {
uj.Service = string(fs.Output.String())
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_SubService:
/* handler: uj.SubService type=string kind=string */
{
{
if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
}
}
if tok == fflib.FFTok_null {
} else {
uj.SubService = string(fs.Output.String())
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_Metric:
/* handler: uj.Metric type=float64 kind=float64 */
{
if tok != fflib.FFTok_double && tok != fflib.FFTok_integer && tok != fflib.FFTok_null {
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for float64", tok))
}
}
{
if tok == fflib.FFTok_null {
} else {
tval, err := fflib.ParseFloat(fs.Output.Bytes(), 64)
if err != nil {
return fs.WrapErr(err)
}
uj.Metric = float64(tval)
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_Tags:
/* handler: uj.Tags type=map[string]string kind=map */
{
/* Falling back. type=map[string]string kind=map */
tbuf, err := fs.CaptureField(tok)
if err != nil {
return fs.WrapErr(err)
}
err = json.Unmarshal(tbuf, &uj.Tags)
if err != nil {
return fs.WrapErr(err)
}
}
state = fflib.FFParse_after_value
goto mainparse
wantedvalue:
return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
wrongtokenerror:
return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
tokerror:
if fs.BigError != nil {
return fs.WrapErr(fs.BigError)
}
err = fs.Error.ToError()
if err != nil {
return fs.WrapErr(err)
}
panic("ffjson-generated: unreachable, please report bug.")
done:
return nil
}
示例8: UnmarshalJSONFFLexer
//.........这里部分代码省略.........
if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
switch currentKey {
case ffj_t_EventStream_Err:
goto handle_Err
case ffj_t_EventStream_Events:
goto handle_Events
case ffj_t_EventStream_Closed:
goto handle_Closed
case ffj_t_EventStreamno_such_key:
err = fs.SkipField(tok)
if err != nil {
return fs.WrapErr(err)
}
state = fflib.FFParse_after_value
goto mainparse
}
} else {
goto wantedvalue
}
}
}
handle_Err:
/* handler: uj.Err type=chan error kind=chan quoted=false*/
{
/* Falling back. type=chan error kind=chan */
tbuf, err := fs.CaptureField(tok)
if err != nil {
return fs.WrapErr(err)
}
err = json.Unmarshal(tbuf, &uj.Err)
if err != nil {
return fs.WrapErr(err)
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_Events:
/* handler: uj.Events type=chan census.Event kind=chan quoted=false*/
{
/* Falling back. type=chan census.Event kind=chan */
tbuf, err := fs.CaptureField(tok)
if err != nil {
return fs.WrapErr(err)
}
err = json.Unmarshal(tbuf, &uj.Events)
if err != nil {
return fs.WrapErr(err)
}
}
state = fflib.FFParse_after_value
goto mainparse
示例9: UnmarshalJSONFFLexer
//.........这里部分代码省略.........
case fflib.FFParse_want_colon:
if tok != fflib.FFTok_colon {
wantedTok = fflib.FFTok_colon
goto wrongtokenerror
}
state = fflib.FFParse_want_value
continue
case fflib.FFParse_want_value:
if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
switch currentKey {
case ffj_t_InMsg_Type:
goto handle_Type
case ffj_t_InMsg_Data:
goto handle_Data
case ffj_t_InMsgno_such_key:
err = fs.SkipField(tok)
if err != nil {
return fs.WrapErr(err)
}
state = fflib.FFParse_after_value
goto mainparse
}
} else {
goto wantedvalue
}
}
}
handle_Type:
/* handler: uj.Type type=string kind=string quoted=false*/
{
{
if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
}
}
if tok == fflib.FFTok_null {
} else {
outBuf := fs.Output.Bytes()
uj.Type = string(string(outBuf))
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_Data:
/* handler: uj.Data type=json.RawMessage kind=slice quoted=false*/
{
if tok == fflib.FFTok_null {
state = fflib.FFParse_after_value
goto mainparse
}
tbuf, err := fs.CaptureField(tok)
if err != nil {
return fs.WrapErr(err)
}
err = uj.Data.UnmarshalJSON(tbuf)
if err != nil {
return fs.WrapErr(err)
}
state = fflib.FFParse_after_value
}
state = fflib.FFParse_after_value
goto mainparse
wantedvalue:
return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok))
wrongtokenerror:
return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String()))
tokerror:
if fs.BigError != nil {
return fs.WrapErr(fs.BigError)
}
err = fs.Error.ToError()
if err != nil {
return fs.WrapErr(err)
}
panic("ffjson-generated: unreachable, please report bug.")
done:
return nil
}
示例10: UnmarshalJSONFFLexer
//.........这里部分代码省略.........
{
{
if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
}
}
if tok == fflib.FFTok_null {
} else {
outBuf := fs.Output.Bytes()
uj.Prefix = string(string(outBuf))
}
}
state = fflib.FFParse_after_value
goto mainparse
handle_Time:
/* handler: uj.Time type=time.Time kind=struct quoted=false*/
{
if tok == fflib.FFTok_null {
state = fflib.FFParse_after_value
goto mainparse
}
tbuf, err := fs.CaptureField(tok)
if err != nil {
return fs.WrapErr(err)
}
err = uj.Time.UnmarshalJSON(tbuf)
if err != nil {
return fs.WrapErr(err)
}
state = fflib.FFParse_after_value
}
state = fflib.FFParse_after_value
goto mainparse
handle_Host:
/* handler: uj.Host type=string kind=string quoted=false*/
{
{
if tok != fflib.FFTok_string && tok != fflib.FFTok_null {
return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok))
}
}
if tok == fflib.FFTok_null {
} else {
outBuf := fs.Output.Bytes()