mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-02 07:54:19 +01:00
This PR brings the Go database/sql driver to it's first working state and adds a Go package to demonstrate. The example pkg demonstrates (in it's most bare/naive form at this point): 1. Open database (memory, in this case) 2. Create connection 3. Prepare statement (Create table) 4. `Exec` 5. Prepare statement (Insert, bind 3 arguments (int, string, blob) ( 6. `Exec` 7. Prepare statement (Select *) 8. `Columns` -> print columns 9. `Query` -> print rows 10. Close db connection  still tons of work to do but I at least wanted to get it to a state where it's not totally broken. I'll add some actual tests tomorrow Closes #796
Limbo driver for Go's database/sql library
NOTE: this is currently heavily W.I.P and is not yet in a usable state. This is merged in only for the purposes of incremental progress and not because the existing code here proper. Expect many and frequent changes.
This uses the purego library to call C (in this case Rust with C ABI) functions from Go without the use of CGO.
To test
Linux | MacOS
All commands listed are relative to the bindings/go directory in the limbo repository
cargo build --package limbo-go
# Your LD_LIBRARY_PATH environment variable must include limbo's `target/debug` directory
LD_LIBRARY_PATH="../../target/debug:$LD_LIBRARY_PATH" go test
Windows
cargo build --package limbo-go
# Copy the lib_limbo_go.dll into the current working directory (bindings/go)
# Alternatively, you could add the .dll to a location in your PATH
cp ../../target/debug/lib_limbo_go.dll .
go test