mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 10:08:20 +00:00
Add time.Time support to Go driver parameter binding
This commit is contained in:
parent
6096cfb3d8
commit
061579e716
1 changed files with 7 additions and 0 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"database/sql/driver"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"time"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
|
@ -244,6 +245,12 @@ func buildArgs(args []driver.Value) ([]limboValue, func(), error) {
|
|||
blob := makeBlob(val)
|
||||
pinner.Pin(blob)
|
||||
*(*uintptr)(unsafe.Pointer(&limboVal.Value)) = uintptr(unsafe.Pointer(blob))
|
||||
case time.Time: // Add this case
|
||||
limboVal.Type = textVal
|
||||
timeStr := val.Format(time.RFC3339)
|
||||
cstr := CString(timeStr)
|
||||
pinner.Pin(cstr)
|
||||
*(*uintptr)(unsafe.Pointer(&limboVal.Value)) = uintptr(unsafe.Pointer(cstr))
|
||||
default:
|
||||
return nil, pinner.Unpin, fmt.Errorf("unsupported type: %T", v)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue