Hi, I'm using pgx as a database/sql driver to build a pg client.
I try to use ColumnTypeLength function to get the type length for varbit type field, but it doesn't work.
I think it would be helpful to me if the code could be rewritten as below:
func (r *Rows) ColumnTypeLength(index int) (int64, bool) {
fd := r.rows.FieldDescriptions()[index]
switch fd.DataTypeOID {
case pgtype.TextOID, pgtype.ByteaOID:
return math.MaxInt64, true
case pgtype.VarcharOID, pgtype.BPCharArrayOID:
return int64(fd.TypeModifier - varHeaderSize), true
case pgtype.VarbitOID:
return int64(fd.TypeModifier), true
default:
return 0, false
}
}
If you don't mind, I could submit a PR~