ColumnTypeLength returns the length of the column type if the column is a variable length type. If the column is not a variable length type ok should return false.
(index int)
| 663 | // variable length type. If the column is not a variable length type ok |
| 664 | // should return false. |
| 665 | func (r *Rows) ColumnTypeLength(index int) (int64, bool) { |
| 666 | fd := r.rows.FieldDescriptions()[index] |
| 667 | |
| 668 | switch fd.DataTypeOID { |
| 669 | case pgtype.TextOID, pgtype.ByteaOID: |
| 670 | return math.MaxInt64, true |
| 671 | case pgtype.VarcharOID, pgtype.BPCharOID: |
| 672 | return int64(fd.TypeModifier - varHeaderSize), true |
| 673 | case pgtype.VarbitOID: |
| 674 | return int64(fd.TypeModifier), true |
| 675 | default: |
| 676 | return 0, false |
| 677 | } |
| 678 | } |
| 679 | |
| 680 | // ColumnTypePrecisionScale should return the precision and scale for decimal |
| 681 | // types. If not applicable, ok should be false. |
nothing calls this directly
no test coverage detected