Skip to content

Conversation

@Pavan-Nambi
Copy link
Contributor

@Pavan-Nambi Pavan-Nambi commented Dec 18, 2025

initial boiler plate is fully ai, other than yml - to get this working on ci for windows

Note - 2k lines are just cargo.lock
also have to add tests

@Pavan-Nambi Pavan-Nambi requested a review from penberg as a code owner December 18, 2025 06:11
Copy link

@turso-bot turso-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review @pereman2

@Pavan-Nambi Pavan-Nambi marked this pull request as draft December 18, 2025 06:59
@Pavan-Nambi Pavan-Nambi force-pushed the rubaby branch 3 times, most recently from dd735fd to b74850b Compare December 19, 2025 05:55
@sivukhin
Copy link
Collaborator

@Pavan-Nambi, looks good!

I recently spent some time with SDK code and I tried to structure them in a way that they either purely depend on sdk-kit and don't have extra Rust layer at all (like Go) or they have very thin layer which basically serves the only purpose of types marshaling and some basic integration (Python).

In ruby case as we use magnus crate I think SDK structure should be similar to python and we must have very thin layer which basically re-export objects from rsapi sdk-kit and everything else will be implemented in pure Ruby.

(for example, right now you implemented transaction method which I think can be easily moved to the Ruby side)

Another note is that you can try to use sdk-kit from sync/ folder which embeds tursodb sdk-kit but also adds support for sync capabilities. I had pretty smooth experience with LLMs able to generate almost all code for tursodb with sync support.
(also, one reason to make extra rust layer thin - is that by my experience LLMs are not so good in writing code using "bindings-provider" like maturin for Python and maybe magnus for Ruby - but they are good in writing basic code in target language)

self.statement.parameters_count()
}
/// returns number of changes made by the statement
pub fn n_change(&self) -> u64 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pavan-Nambi , can you also add this method to the capi?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do.

@Pavan-Nambi Pavan-Nambi force-pushed the rubaby branch 2 times, most recently from a72c6e7 to 16fc94d Compare December 22, 2025 14:20
Add Ruby bindings using Magnus FFI library with turso_sdk_kit integration:

- errors.rs: Exception class hierarchy (Error, BusyError, ConstraintError, etc.)
  with map_turso_error() for TursoError -> Ruby exception conversion
- database.rs: RbDatabase with open() and connect()
- connection.rs: RbConnection with execute(), prepare(), transaction(),
  changes(), last_insert_row_id(), in_transaction?(), close()
- statement.rs: RbStatement with bind(), step(), execute(), columns(),
  reset!(), finalize!() and AtomicBool lifecycle tracking
- value.rs: Ruby <-> Turso type conversions (nil, bool, int, float, string, blob)

Known limitation: changes() returns 0 as sdk-kit doesn't expose n_change()
on TursoStatement after stepping. Python/Go use execute() return value.
- Add cross-platform CI (Ubuntu/macOS/Windows × Ruby 3.1-3.3)
- Fix deprecated magnus API calls
- Add Ruby patterns to .gitignore
test

test
 - ResultSet as a GC-safe, enumerable hybrid result set. ...exposed changes() for same reason
 - fix ruby exception maps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants