Commit Graph

71 Commits

Author SHA1 Message Date
Jussi Saurio
a48b6d049a Another post-rebase clippy round with 1.88.0 2025-07-12 19:10:56 +03:00
Nils Koch
828d4f5016 fix clippy errors for rust 1.88.0 (auto fix) 2025-07-12 18:58:41 +03:00
pedrocarlo
711b1ef114 make all run_once be run under statement or connection so that rollback is called 2025-07-07 11:51:25 -03:00
PThorpe92
bbee10ba2c Add mvcc and index config to connection open api 2025-06-30 22:04:56 -04:00
PThorpe92
51ef3774ab Use connection::from_uri method in Go bindings 2025-06-30 22:03:51 -04:00
Pekka Enberg
9c1b7897ac Fix URLs to point to github.com/tursodatabase/turso 2025-06-30 11:23:53 +03:00
Pekka Enberg
53ba3ff926 Rename limbo_core crate to turso_core 2025-06-29 09:59:17 +03:00
Pekka Enberg
2fc5c0ce5c Switch to runtime flag for enabling indexes
Makes it easier to test the feature:

```
$ cargo run --  --experimental-indexes
Limbo v0.0.22
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database
limbo> CREATE TABLE t(x);
limbo> CREATE INDEX t_idx ON t(x);
limbo> DROP INDEX t_idx;
```
2025-06-26 10:07:28 +03:00
Pekka Enberg
90c1e3fc06 Switch Connection to use Arc instead of Rc
Connection needs to be Arc so that bindings can wrap it with `Mutex` for
multi-threading.
2025-06-16 10:43:19 +03:00
Pekka Enberg
e3f71259d8 Rename OwnedValue -> Value
We have not had enough merge conflicts for a while so let's do a
tree-wide rename.
2025-05-15 09:59:46 +03:00
Jussi Saurio
7b388b9696 Merge 'Bindings/Go: Fix symbols for FFI calls' from Preston Thorpe
While debugging another issue for #1469, I noticed that the symbols
aren't being properly referenced for `getError` for either limboRows or
limboStmt types.

Closes #1470
2025-05-12 10:44:31 +03:00
PThorpe92
755a19658f Bindings/Go: Fix symbols for rows + stmt getError FFI calls 2025-05-11 15:26:07 -04:00
PThorpe92
1c7a50de96 Update comments and correct vtab insert behavior 2025-05-10 10:03:00 -04:00
PThorpe92
50f2621c12 Add several more rust tests for parameter binding 2025-05-10 07:46:29 -04:00
PThorpe92
7a5422ee30 Clean up api for remap parameters and consoidate code 2025-05-10 07:46:29 -04:00
PThorpe92
3b09b9892c Comment out Go tests for binding parameters 2025-05-10 07:46:29 -04:00
PThorpe92
273711bf81 Impl Debug for Limbo value type in Go bindings 2025-05-10 07:46:28 -04:00
PThorpe92
e5723b2ca1 Add test in Go bindings for parameters at diff indexes than table ordering 2025-05-10 07:44:29 -04:00
Pekka Enberg
a105c20f69 Merge 'Implement transaction support in Go adapter' from Jonathan Ness
This PR implements basic transaction support in the Limbo Go adapter by
adding the required methods to fulfill the `driver.Tx` interface.
## Changes
- Add `Begin()` method to `limboConn` to start a transaction
- Add `BeginTx()` method with context support and proper handling of
transaction options
- Implement `Commit()` method to commit transaction changes
- Implement `Rollback()` method with appropriate error handling
- Add transaction tests
## Implementation Details
- Uses the standard SQLite transaction commands (BEGIN, COMMIT,
ROLLBACK)
- Follows the same pattern as other SQL operations in the adapter
(prepare-execute-close)
- Maintains consistent locking and error handling patterns
## Limitations
- Currently, ROLLBACK operations will return an error as they're not yet
fully supported in the underlying Limbo implementation
- Only the default isolation level is supported; all other isolation
levels return `driver.ErrSkip`
- Read-only transactions are not supported and return `driver.ErrSkip`
## Testing
- Added basic transaction tests that verify BEGIN and COMMIT operations
- Adjusted tests to work with the current Limbo implementation
capabilities
These transaction methods enable the Go adapter to be used in
applications that require transaction support while providing clear
error messages when unsupported features are requested.  I'll add to it
when Limbo supports ROLLBACK and/or additional isolation levels.

Closes #1435
2025-05-10 07:58:29 +03:00
Pekka Enberg
9bf3f1e90d Merge 'Add time.Time and bool data types support in Go adapter' from Jonathan Ness
PR #1442 added support for using time.Time as query parameters.
Scanning time.Time values from query results still fails:
`sql: Scan error on column index 4, name "mod_time": unsupported Scan,
storing driver.Value type string into type *time.Time`
This change modifies the `toGoValue` function to detect RFC3339
formatted datetime strings and convert them back to time.Time objects
when reading from the database. This provides complete roundtrip support
for time.Time values.
Also added boolean support by converting Go bool values to integers (0
for false, 1 for true) when binding parameters, following SQLite's
convention for representing boolean values.

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #1465
2025-05-10 07:54:10 +03:00
PThorpe92
efd4767b6a Bindings/Go: Upgrade ebitengine/purego to allow for use with go 1.23.9 2025-05-09 20:25:29 -04:00
jnesss
02d141e3ce add support for bool type 2025-05-09 09:01:24 -07:00
jnesss
c0dd79adc2 Add time.Time support for scanning query results 2025-05-08 20:51:54 -07:00
Jonathan Ness
dd56d92b6a Merge branch 'main' into feature/go-transactions 2025-05-07 12:48:20 -07:00
Pekka Enberg
2bd221e5db Merge 'Add embedded library support to Go adapter' from Jonathan Ness
This change enables the Go adapter to embed platform-specific libraries
and extract them at runtime, eliminating the need for users to set
LD_LIBRARY_PATH or other environment variables.
- Add embedded.go with core library extraction functionality
- Update limbo_unix.go and limbo_windows.go to use embedded libraries
- Add build_lib.sh script to generate platform-specific libraries
- Update README.md with documentation for the new feature
- Add .gitignore to prevent committing binary files
- Add test coverage for Vector operations (vector(), vector_extract(),
vector_distance_cos()) and sqlite core features
The implementation maintains backward compatibility with the traditional
library loading mechanism as a fallback. This approach is inspired by
projects like go-embed-python that use a similar technique for native
library distribution.
https://github.com/tursodatabase/limbo/issues/506

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #1434
2025-05-07 22:31:29 +03:00
jnesss
a4c0f57f82 added embedded library usage notes 2025-05-06 21:43:18 -07:00
jnesss
548bcd4692 accept debug or release parameter - default to release 2025-05-06 20:44:02 -07:00
Jonathan Ness
65e18cb578 Merge branch 'main' into feature/go-transactions 2025-05-03 16:09:17 -07:00
Jonathan Ness
344ec5befb Merge pull request #2 from jnesss/go-adapter-tests
Go adapter tests
2025-05-03 15:36:51 -07:00
jnesss
061579e716 Add time.Time support to Go driver parameter binding 2025-05-03 14:09:25 -07:00
jnesss
091169af38 Go uses amd64 to refer to the 64-bit x86 architecture, while Linux
systems report x86_64. This change maps the architecture names to ensure the built libraries are placed in the correct directories for Go's embedded loading system (e.g., libs/linux_amd64)
2025-05-03 10:23:27 -07:00
jnesss
69965b4eee remove TestTransactions that was being skipped. added back in second PR 2025-05-02 14:44:49 -07:00
jnesss
2f0bbf6b22 Implement transaction support in Go adapter 2025-05-02 14:39:23 -07:00
jnesss
aed36c5b30 change to address CI failure. libs dir must exist with at least one file during build time. Add libs/.gitkeep as placeholder. Update .gitignore to exclude built libs but keep placeholder. This change is for CI purposes only 2025-05-02 13:02:52 -07:00
jnesss
bcb2f9f307 add documentation for new embedded library feature, including usage instructions and implementation notes 2025-05-02 12:45:30 -07:00
jnesss
1a3c3866b8 Update Windows library loading to prioritize the embedded library while maintaining compatibility with PATH-based lookup 2025-05-02 12:44:46 -07:00
jnesss
1e0b4676dc Update library loading mechanism to first attempt using the embedded library before falling back to traditional LD_LIBRARY_PATH lookup 2025-05-02 12:44:24 -07:00
jnesss
2476d2c6c2 embeds and extracts platform-specific libraries at runtime using Go's embed package 2025-05-02 12:43:36 -07:00
jnesss
322c2859e6 platform-specific build script that generates and organizes library for embedding into Go binaries 2025-05-02 12:42:38 -07:00
jnesss
992324f318 Add .gitignore for generated library files 2025-05-02 12:41:47 -07:00
jnesss
a9b5fc7f63 Add tests for vector operations and date/time functions in Go adapter 2025-05-02 11:30:31 -07:00
Pere Diaz Bou
d9f5cd870d clippy 2025-03-29 22:04:08 +01:00
Pere Diaz Bou
ee55116ca6 return row as reference to registers 2025-03-29 22:04:08 +01:00
Pere Diaz Bou
5b7fcd27bd make column reuse blob/text fields 2025-03-29 22:02:49 +01:00
Pere Diaz Bou
bf37fd3314 wip 2025-03-29 22:02:49 +01:00
Pere Diaz Bou
9291f60722 Introduce Register struct
OwnedValue has become a powerhouse of madness, mainly because I decided
to do it like that when I first introduced AggContext. I decided it was
enough and I introduced a `Register` struct that contains `OwnedValue`,
`Record` and `Aggregation`, this way we don't use `OwnedValue` for
everything make everyone's life harder.

This is the next step towards making ImmutableRecords the default
because I want to remove unnecessary allocations. Right now we clone
OwnedValues when we generate a record more than needed.
2025-03-27 17:53:02 +01:00
Pekka Enberg
96175cccf7 cli: Add --experimental-mvcc option to enable MVCC 2025-03-06 10:16:42 +02:00
Pere Diaz Bou
8daf7666d1 Make database Sync + Send 2025-03-05 14:07:48 +01:00
PThorpe92
6a919ac691 Remove uri parsing in go bindings because it has been added in core 2025-02-26 10:17:26 -05:00
Pekka Enberg
936ae307b7 core: Kill value type
We currently have two value types, `Value` and `OwnedValue`. The
original thinking was that `Value` is external type and `OwnedValue` is
internal type. However, this just results in unnecessary transformation
between the types as data crosses the Limbo library boundary.

Let's just follow SQLite here and consolidate on a single value type
(where `sqlite3_value` is just an alias for the internal `Mem` type).
The way this will eventually work is that we can have bunch of
pre-allocated `OwnedValue` objects in `ProgramState` and basically
return a reference to them all the way to the application itself, which
extracts the actual value.
2025-02-26 10:57:45 +02:00