(field *Field, value any)
| 99 | } |
| 100 | |
| 101 | func formatField(field *Field, value any) error { |
| 102 | switch value.(type) { |
| 103 | case int8, int16, int32, int64, int: |
| 104 | field.Charset = 63 |
| 105 | field.Flag = BINARY_FLAG | NOT_NULL_FLAG |
| 106 | case uint8, uint16, uint32, uint64, uint: |
| 107 | field.Charset = 63 |
| 108 | field.Flag = BINARY_FLAG | NOT_NULL_FLAG | UNSIGNED_FLAG |
| 109 | case float32, float64: |
| 110 | field.Charset = 63 |
| 111 | field.Flag = BINARY_FLAG | NOT_NULL_FLAG |
| 112 | case string, []byte: |
| 113 | field.Charset = 33 |
| 114 | case nil: |
| 115 | field.Charset = 33 |
| 116 | default: |
| 117 | return errors.Errorf("unsupported type %T for resultset", value) |
| 118 | } |
| 119 | return nil |
| 120 | } |
| 121 | |
| 122 | func BuildSimpleTextResultset(names []string, values [][]any) (*Resultset, error) { |
| 123 | r := new(Resultset) |
no outgoing calls
no test coverage detected