mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-23 08:55:40 +01:00
add documentation for new embedded library feature, including usage instructions and implementation notes
This commit is contained in:
@@ -1,14 +1,30 @@
|
||||
# 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 driver uses the awesome [purego](https://github.com/ebitengine/purego) library to call C (in this case Rust with C ABI) functions from Go without the use of `CGO`.
|
||||
|
||||
## Embedded Library Support
|
||||
|
||||
This driver now includes an embedded library feature that allows you to distribute a single binary without requiring users to set environment variables. The library for your platform is automatically embedded, extracted at runtime, and loaded dynamically.
|
||||
|
||||
To build with embedded library support:
|
||||
```
|
||||
# From the bindings/go directory
|
||||
./build_lib.sh
|
||||
```
|
||||
|
||||
If the embedded library cannot be found or extracted, the driver will fall back to the traditional method of finding the library in the system paths.
|
||||
|
||||
## To use: (_UNSTABLE_ testing or development purposes only)
|
||||
|
||||
### Linux | MacOS
|
||||
### Option 1: Using the embedded library (recommended)
|
||||
|
||||
Build the driver with the embedded library as described above, then simply import and use. No environment variables needed!
|
||||
|
||||
### Option 2: Manual library setup
|
||||
|
||||
#### Linux | MacOS
|
||||
|
||||
_All commands listed are relative to the bindings/go directory in the limbo repository_
|
||||
|
||||
@@ -21,7 +37,7 @@ export LD_LIBRARY_PATH="/path/to/limbo/target/debug:$LD_LIBRARY_PATH"
|
||||
|
||||
```
|
||||
|
||||
## Windows
|
||||
#### Windows
|
||||
|
||||
```
|
||||
cargo build --package limbo-go
|
||||
@@ -69,3 +85,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
The embedded library feature was inspired by projects like [go-embed-python](https://github.com/kluctl/go-embed-python), which uses a similar approach for embedding and distributing native libraries with Go applications.
|
||||
|
||||
Reference in New Issue
Block a user