當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。