Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions database/gdb/gdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ const (
LocalTypeUint LocalType = "uint"
LocalTypeInt64 LocalType = "int64"
LocalTypeUint64 LocalType = "uint64"
LocalTypeBigInt LocalType = "bigint"
LocalTypeIntSlice LocalType = "[]int"
LocalTypeInt64Slice LocalType = "[]int64"
LocalTypeUint64Slice LocalType = "[]uint64"
Expand Down Expand Up @@ -814,6 +815,10 @@ const (
fieldTypeBigInt = "big_int"
fieldTypeBigint = "bigint"
fieldTypeBigserial = "bigserial"
fieldTypeInt128 = "int128"
fieldTypeInt256 = "int256"
fieldTypeUint128 = "uint128"
fieldTypeUint256 = "uint256"
fieldTypeReal = "real"
fieldTypeFloat = "float"
fieldTypeDouble = "double"
Expand Down
18 changes: 18 additions & 0 deletions database/gdb/gdb_core_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package gdb
import (
"context"
"database/sql/driver"
"math/big"
"reflect"
"strings"
"time"
Expand Down Expand Up @@ -277,6 +278,13 @@ func (c *Core) CheckLocalTypeForField(ctx context.Context, fieldType string, _ i
}
return LocalTypeInt64, nil

case
fieldTypeInt128,
fieldTypeInt256,
fieldTypeUint128,
fieldTypeUint256:
return LocalTypeBigInt, nil

case
fieldTypeReal:
return LocalTypeFloat32, nil
Expand Down Expand Up @@ -403,6 +411,16 @@ func (c *Core) ConvertValueForLocal(
case LocalTypeUint64Bytes:
return gbinary.BeDecodeToUint64(gconv.Bytes(fieldValue)), nil

case LocalTypeBigInt:
switch v := fieldValue.(type) {
case big.Int:
return v.String(), nil
case *big.Int:
return v.String(), nil
default:
return gconv.String(fieldValue), nil
}

case LocalTypeFloat32:
return gconv.Float32(gconv.String(fieldValue)), nil

Expand Down
Loading