Documentation
¶
Overview ¶
Go bindings for the turso database.
This file implements library embedding and extraction at runtime, a pattern also used in several other Go projects that need to distribute native binaries:
github.com/kluctl/go-embed-python: Embeds a full Python distribution in Go binaries, extracting to temporary directories at runtime. The approach used here was directly inspired by its embed_util implementation.
github.com/kluctl/go-jinja2: Uses the same pattern to embed Jinja2 and related Python libraries, allowing Go applications to use Jinja2 templates without external dependencies.
This approach has several advantages: - Allows distribution of a single, self-contained binary - Eliminates the need for users to set LD_LIBRARY_PATH or other environment variables - Works cross-platform with the same codebase - Preserves backward compatibility with existing methods - Extracts libraries only once per execution via sync.Once
The embedded library is extracted to a user-specific temporary directory and loaded dynamically. If extraction fails, the code falls back to the traditional method of searching system paths.
Index ¶
Constants ¶
const ( RowsClosedErr = "sql: Rows closed" FfiDbOpen = "db_open" FfiDbClose = "db_close" FfiDbPrepare = "db_prepare" FfiDbGetError = "db_get_error" FfiConnLastInsertId = "stmt_last_insert_id" FfiConnChanges = "stmt_changes" FfiStmtExec = "stmt_execute" FfiStmtQuery = "stmt_query" FfiStmtReset = "stmt_reset" FfiRowsGetColumnType = "rows_get_column_type" FfiStmtParameterCount = "stmt_parameter_count" FfiStmtGetError = "stmt_get_error" FfiStmtClose = "stmt_close" FfiRowsClose = "rows_close" FfiRowsGetColumns = "rows_get_columns" FfiRowsGetColumnName = "rows_get_column_name" FfiRowsNext = "rows_next" FfiRowsGetValue = "rows_get_value" FfiRowsGetError = "rows_get_error" FfiFreeColumns = "free_columns" FfiFreeCString = "free_string" FfiFreeBlob = "free_blob" FfiDbPing = "db_ping" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ResultCode ¶
type ResultCode int32
const ( Error ResultCode = -1 Ok ResultCode = 0 Row ResultCode = 1 Busy ResultCode = 2 Io ResultCode = 3 Interrupt ResultCode = 4 Invalid ResultCode = 5 Null ResultCode = 6 NoMem ResultCode = 7 ReadOnly ResultCode = 8 NoData ResultCode = 9 Done ResultCode = 10 SyntaxErr ResultCode = 11 ConstraintViolation ResultCode = 12 NoSuchEntity ResultCode = 13 )
func (ResultCode) String ¶
func (rc ResultCode) String() string