MCPcopy
hub / github.com/gogf/gf / columnValueToLocalValue

Method columnValueToLocalValue

database/gdb/gdb_core_underlying.go:517–533  ·  view source on GitHub ↗
(ctx context.Context, value any, columnType *sql.ColumnType)

Source from the content-addressed store, hash-verified

515}
516
517func (c *Core) columnValueToLocalValue(ctx context.Context, value any, columnType *sql.ColumnType) (any, error) {
518 var scanType = columnType.ScanType()
519 if scanType != nil {
520 // Common basic builtin types.
521 switch scanType.Kind() {
522 case
523 reflect.Bool,
524 reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
525 reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
526 reflect.Float32, reflect.Float64:
527 return gconv.Convert(gconv.String(value), scanType.String()), nil
528 default:
529 }
530 }
531 // Other complex types, especially custom types.
532 return c.db.ConvertValueForLocal(ctx, columnType.DatabaseTypeName(), value)
533}

Callers 1

RowsToResultMethod · 0.95

Calls 5

ConvertFunction · 0.92
StringFunction · 0.92
KindMethod · 0.80
StringMethod · 0.65
ConvertValueForLocalMethod · 0.65

Tested by

no test coverage detected