MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / formatField

Function formatField

IceFireDB-SQLite/pkg/mysql/mysql/resultset_helper.go:101–120  ·  view source on GitHub ↗
(field *Field, value any)

Source from the content-addressed store, hash-verified

99}
100
101func 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
122func BuildSimpleTextResultset(names []string, values [][]any) (*Resultset, error) {
123 r := new(Resultset)

Callers 2

BuildSimpleTextResultsetFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected