MakeCollatedString constructs a new instance of a CollatedStringFamily type that is collated according to the given locale. The new type is based upon the given string type, having the same oid and width values. For example: STRING => STRING COLLATE EN VARCHAR(20) => VARCHAR(20) COLLATE EN
(strType *T, locale string)
| 805 | // STRING => STRING COLLATE EN |
| 806 | // VARCHAR(20) => VARCHAR(20) COLLATE EN |
| 807 | func MakeCollatedString(strType *T, locale string) *T { |
| 808 | switch strType.Oid() { |
| 809 | case oid.T_text, oid.T_varchar, oid.T_bpchar, oid.T_char, oid.T_name: |
| 810 | return &T{InternalType: InternalType{ |
| 811 | Family: CollatedStringFamily, Oid: strType.Oid(), Width: strType.Width(), Locale: &locale}} |
| 812 | } |
| 813 | panic(errors.AssertionFailedf("cannot apply collation to non-string type: %s", strType)) |
| 814 | } |
| 815 | |
| 816 | // MakeDecimal constructs a new instance of a DECIMAL type (oid = T_numeric) |
| 817 | // that has at most "precision" # of decimal digits (0 = unspecified number of |
no test coverage detected