MCPcopy Create free account
hub / github.com/dolthub/doltgresql / decodeTextColumnData

Function decodeTextColumnData

server/logrepl/replication.go:800–812  ·  view source on GitHub ↗

decodeTextColumnData decodes the given data using the given data type OID and returns the result as a golang value

(mi *pgtype.Map, data []byte, dataType uint32)

Source from the content-addressed store, hash-verified

798
799// decodeTextColumnData decodes the given data using the given data type OID and returns the result as a golang value
800func decodeTextColumnData(mi *pgtype.Map, data []byte, dataType uint32) (interface{}, error) {
801 switch oid.Oid(dataType) {
802 case oid.T_date, oid.T_time, oid.T_timestamp, oid.T_timestamptz, oid.T__date, oid.T__time, oid.T__timestamp, oid.T__timestamptz:
803 // The codec converts time values into a format that breaks our assumptions later on, which is unnecessary as
804 // the server sends the correctly-formatted time anyway.
805 return string(data), nil
806 default:
807 if dt, ok := mi.TypeForOID(dataType); ok {
808 return dt.Codec.DecodeValue(mi, dataType, pgtype.TextFormatCode, data)
809 }
810 return string(data), nil
811 }
812}
813
814// encodeColumnData encodes the given data using the given data type OID and returns the result as a string to be
815// used in an INSERT or other DML query.

Callers 1

processMessageMethod · 0.85

Calls 1

OidMethod · 0.80

Tested by

no test coverage detected