MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / Encode

Method Encode

base/collection_gocb.go:510–517  ·  view source on GitHub ↗

SGJSONTranscoder.Encode supports writing JSON as either raw bytes or an unmarshalled interface

(value interface{})

Source from the content-addressed store, hash-verified

508
509// SGJSONTranscoder.Encode supports writing JSON as either raw bytes or an unmarshalled interface
510func (t *SGJSONTranscoder) Encode(value interface{}) ([]byte, uint32, error) {
511 switch value.(type) {
512 case []byte, *[]byte:
513 return gocb.NewRawJSONTranscoder().Encode(value)
514 default:
515 return gocb.NewJSONTranscoder().Encode(value)
516 }
517}
518
519// SGBinaryTranscoder uses the appropriate raw transcoder for the data type. Provides backward compatibility
520// for pre-3.0 documents intended to be binary but written with JSON datatype, and vice versa

Callers

nothing calls this directly

Calls 1

EncodeMethod · 0.65

Tested by

no test coverage detected