MCPcopy
hub / github.com/tinode/chat / UnmarshalJSON

Method UnmarshalJSON

server/store/types/types.go:476–485  ·  view source on GitHub ↗

UnmarshalJSON reads ObjState from a quoted string.

(b []byte)

Source from the content-addressed store, hash-verified

474
475// UnmarshalJSON reads ObjState from a quoted string.
476func (os *ObjState) UnmarshalJSON(b []byte) error {
477 if b[0] != '"' || b[len(b)-1] != '"' {
478 return errors.New("syntax error")
479 }
480 state, err := NewObjState(string(b[1 : len(b)-1]))
481 if err == nil {
482 *os = state
483 }
484 return err
485}
486
487// Scan is an implementation of sql.Scanner interface. It expects the
488// value to be a byte slice representation of an ASCII string.

Callers

nothing calls this directly

Calls 1

NewObjStateFunction · 0.85

Tested by

no test coverage detected