vecext

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package vecext makes SQLite's vec0 virtual table module (from github.com/asg017/sqlite-vec) available to mattn/go-sqlite3 connections.

Why this package exists instead of importing sqlite-vec's own Go bindings directly: those bindings' C code does `#include "sqlite3.h"`, but mattn/go-sqlite3 bundles its SQLite amalgamation under the filename sqlite3-binding.h instead — there's no "sqlite3.h" on the include path for it to find. Discovered in milestone 1 (see internal/store's history) and deferred until an actual embedding worker needed chunk_vectors to exist.

The fix: vendor sqlite-vec's C source alongside a COPY of mattn/go-sqlite3's header renamed to sqlite3.h, and compile them as part of THIS package with our own #cgo CFLAGS -I pointing at that copy. cgo flags are scoped per package, so we can't inject an -I into the upstream bindings' compilation — but we don't need to: C symbol resolution happens at the final link, not per-package compile, so sqlite-vec.c only needs SOME header with matching declarations to compile against. The actual sqlite3_* function bodies still come from mattn's compiled amalgamation, since both end up as object files linked into the same Go binary. Using an exact copy of mattn's own header (not a generic sqlite3.h from sqlite.org) guarantees the declarations match mattn's actual SQLite build, not just "a" SQLite build.

sqlite-vec.c/sqlite-vec.h are vendored verbatim from github.com/asg017/sqlite-vec-go-bindings@v0.1.6 (MIT); sqlite3.h is an unmodified copy of github.com/mattn/go-sqlite3@v1.14.52's sqlite3-binding.h, renamed only so the #include resolves. Bump both alongside their real go.mod dependency versions if either changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register()

Register makes vec0 available on every SQLite connection opened in this process from here on, via sqlite3_auto_extension. Must be called before any *sql.DB is opened — internal/store does this in an init().

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL