当前位置: 首页>>代码示例>>Golang>>正文


Golang v1.NewFFLexer函数代码示例

本文整理汇总了Golang中github.com/pquerna/ffjson/fflib/v1.NewFFLexer函数的典型用法代码示例。如果您正苦于以下问题:Golang NewFFLexer函数的具体用法?Golang NewFFLexer怎么用?Golang NewFFLexer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NewFFLexer函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: DecodeFast

// DecodeFast will unmarshal the data if fast unmarshal is available.
// This function can be used if you want to be sure the fast
// unmarshal is used or in testing.
// If you would like to have fallback to encoding/json you can use the
// regular Decode() method.
func (d *Decoder) DecodeFast(data []byte, v interface{}) error {
	f, ok := v.(unmarshalFaster)
	if !ok {
		return errors.New("ffjson unmarshal not available for type " + reflect.TypeOf(v).String())
	}
	if d.fs == nil {
		d.fs = fflib.NewFFLexer(data)
	} else {
		d.fs.Reset(data)
	}
	return f.UnmarshalJSONFFLexer(d.fs, fflib.FFParse_map_start)
}
开发者ID:RCwukaka,项目名称:registry,代码行数:17,代码来源:decoder.go

示例2: Unmarshal

// Unmarshal will act the same way as json.Unmarshal, except
// it will choose the ffjson unmarshal function before falling
// back to using json.Unmarshal.
// The overhead of unmarshal is lower than on Marshal,
// however this should still provide a speedup for your encoding.
// It is ok to call this function even if no ffjson code has been
// generated for the data type you pass in the interface.
func Unmarshal(data []byte, v interface{}) error {
	f, ok := v.(unmarshalFaster)
	if ok {
		fs := fflib.NewFFLexer(data)
		return f.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
	}

	j, ok := v.(json.Unmarshaler)
	if ok {
		return j.UnmarshalJSON(data)
	}
	return json.Unmarshal(data, v)
}
开发者ID:RCwukaka,项目名称:registry,代码行数:20,代码来源:marshal.go

示例3: Decode

// Decode the data in the supplied data slice.
func (d *Decoder) Decode(data []byte, v interface{}) error {
	f, ok := v.(unmarshalFaster)
	if ok {
		if d.fs == nil {
			d.fs = fflib.NewFFLexer(data)
		} else {
			d.fs.Reset(data)
		}
		return f.UnmarshalJSONFFLexer(d.fs, fflib.FFParse_map_start)
	}

	um, ok := v.(json.Unmarshaler)
	if ok {
		return um.UnmarshalJSON(data)
	}
	return json.Unmarshal(data, v)
}
开发者ID:RCwukaka,项目名称:registry,代码行数:18,代码来源:decoder.go

示例4: UnmarshalJSON

func (uj *Pos2D) UnmarshalJSON(input []byte) error {
	fs := fflib.NewFFLexer(input)
	return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
}
开发者ID:benjamin-rood,项目名称:abm-cp,代码行数:4,代码来源:render_ffjson.go

示例5: UnmarshalJSON

func (uj *ServiceDefinition) UnmarshalJSON(input []byte) error {
	fs := fflib.NewFFLexer(input)
	return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
}
开发者ID:christian-blades-cb,项目名称:desoto,代码行数:4,代码来源:servicedef_ffjson.go

示例6: UnmarshalJSON

func (uj *MtBroadCastMessage) UnmarshalJSON(input []byte) error {
	fs := fflib.NewFFLexer(input)
	return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
}
开发者ID:nagae-memooff,项目名称:surgemq,代码行数:4,代码来源:process_ffjson.go


注:本文中的github.com/pquerna/ffjson/fflib/v1.NewFFLexer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。