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)
| 651 | // VARCHAR(20) => VARCHAR(20) COLLATE EN |
| 652 | // |
| 653 | func MakeCollatedString(strType *T, locale string) *T { |
| 654 | switch strType.Oid() { |
| 655 | case oid.T_text, oid.T_varchar, oid.T_bpchar, oid.T_char, oid.T_name: |
| 656 | return &T{InternalType: InternalType{ |
| 657 | Family: CollatedStringFamily, Oid: strType.Oid(), Width: strType.Width(), Locale: &locale}} |
| 658 | } |
| 659 | panic(errors.AssertionFailedf("cannot apply collation to non-string type: %s", strType)) |
| 660 | } |
| 661 | |
| 662 | // MakeDecimal constructs a new instance of a DECIMAL type (oid = T_numeric) |
| 663 | // that has at most "precision" # of decimal digits (0 = unspecified number of |
no test coverage detected
searching dependent graphs…