mirror of https://github.com/jackc/pgx.git
Add MarshalJSON for FieldDescription
parent
0d1ceed7a6
commit
4c03ce451f
|
@ -23,6 +23,27 @@ type FieldDescription struct {
|
||||||
Format int16
|
Format int16
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalJSON implements encoding/json.Marshaler.
|
||||||
|
func (fd FieldDescription) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(struct {
|
||||||
|
Name string
|
||||||
|
TableOID uint32
|
||||||
|
TableAttributeNumber uint16
|
||||||
|
DataTypeOID uint32
|
||||||
|
DataTypeSize int16
|
||||||
|
TypeModifier int32
|
||||||
|
Format int16
|
||||||
|
}{
|
||||||
|
Name: string(fd.Name),
|
||||||
|
TableOID: fd.TableOID,
|
||||||
|
TableAttributeNumber: fd.TableAttributeNumber,
|
||||||
|
DataTypeOID: fd.DataTypeOID,
|
||||||
|
DataTypeSize: fd.DataTypeSize,
|
||||||
|
TypeModifier: fd.TypeModifier,
|
||||||
|
Format: fd.Format,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
type RowDescription struct {
|
type RowDescription struct {
|
||||||
Fields []FieldDescription
|
Fields []FieldDescription
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue