LibSqlEx (LibSqlEx v0.1.1)

View Source

Documentation for Libsqlex.

doesn't support handle_fetch, declare, & deallocate

Features

  • Connection handling via Rust NIF
  • Transaction support (begin, commit, rollback)
  • Query execution in both transactional and non-transactional contexts

Summary

Functions

Opens a connection to LibSQL using the native Rust layer.

Disconnects from the database by closing the underlying native connection by deleting the connection registr.

Begins a new database transaction.

Closes the query. Currently a no-op.

Commits the current transaction. The state must provide a uuid string of trx_id/transaction id

Executes an SQL query, delegating to transactional or non-transactional logic depending on the connection state.

Rollback the current transaction.

Pings the current connection to ensure it is still alive.

Functions

connect(opts)

Opens a connection to LibSQL using the native Rust layer.

Returns {:ok, state} on success or {:error, reason} on failure. Automatically using remote replica if the opts provided database, uri, and auth token.

disconnect(opts, state)

Disconnects from the database by closing the underlying native connection by deleting the connection registr.

handle_begin(opts, state)

Begins a new database transaction.

handle_close(query, opts, state)

Closes the query. Currently a no-op.

handle_commit(opts, state)

Commits the current transaction. The state must provide a uuid string of trx_id/transaction id

handle_execute(query, args, opts, state)

Executes an SQL query, delegating to transactional or non-transactional logic depending on the connection state.

handle_rollback(opts, state)

Rollback the current transaction.

ping(state)

Pings the current connection to ensure it is still alive.