sqlString converts given type value to output string. This is the same as IoOutput function with an exception to BOOLEAN type. It returns "t" instead of "true".
(ctx *sql.Context, t *DoltgresType, val any)
| 146 | // sqlString converts given type value to output string. This is the same as IoOutput function |
| 147 | // with an exception to BOOLEAN type. It returns "t" instead of "true". |
| 148 | func sqlString(ctx *sql.Context, t *DoltgresType, val any) (string, error) { |
| 149 | if t.IsArrayType() { |
| 150 | baseType := t.ArrayBaseType() |
| 151 | return ArrToString(ctx, val.([]any), baseType, true) |
| 152 | } else if t.ID == Bool.ID { |
| 153 | if val.(bool) { |
| 154 | return "t", nil |
| 155 | } else { |
| 156 | return "f", nil |
| 157 | } |
| 158 | } |
| 159 | return t.IoOutput(ctx, val) |
| 160 | } |
| 161 | |
| 162 | // ArrToString is used for array_out function. |trimBool| parameter allows replacing |
| 163 | // boolean result of "true" to "t" if the function is `Type.SQL()`. |
no test coverage detected