Documentation
¶
Overview ¶
Package sqlitevec ships the asg017/sqlite-vec C extension embedded in the binary and extracts it to $DATA_DIR/ext/ at runtime so the mattn driver can LOAD EXTENSION it.
Windows is explicitly unsupported — there is no windows embed here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyExtension = errors.New("sqlitevec: embedded vec0 asset is empty (placeholder — real binary not bundled)")
ErrEmptyExtension is returned when the embedded asset is a 0-byte placeholder (i.e. the real release binary was not dropped in at build time). Callers should treat this as "fall back".
var ErrExtensionEmpty = errors.New("sqlitevec: extension file is empty (placeholder)")
ErrExtensionEmpty is returned when the extension file is 0 bytes (i.e. the embedded asset was a placeholder that got extracted, so the path exists but the file is useless). Callers should treat this as "fall back".
var ErrExtensionMissing = errors.New("sqlitevec: extension file missing on disk")
ErrExtensionMissing is returned when the extension file does not exist on disk at LoadInto time. Callers should treat this as "fall back".
var ErrUnsupportedPlatform = errors.New("sqlitevec: unsupported GOOS/GOARCH (no embedded vec0 binary)")
ErrUnsupportedPlatform is returned when GOOS/GOARCH doesn't have an embedded sqlite-vec binary. Callers should treat this as "fall back to brute-force / pure-Go HNSW".
Functions ¶
func Extract ¶
Extract writes the embedded sqlite-vec shared object for the current GOOS/GOARCH into $dataDir/ext/vec0.<ext> and returns the absolute path.
Idempotent: if the destination already exists and its size matches the embedded asset, the existing file is kept. Mode is 0o755.
Returns ErrUnsupportedPlatform if GOOS/GOARCH has no embedded asset, and ErrEmptyExtension if the embedded asset is a 0-byte placeholder. In both cases callers should fall back to pure-Go search.
func LoadInto ¶
LoadInto loads the sqlite-vec extension at soPath into every connection of db. Implementation detail: grabs a raw conn via db.Conn(ctx).Raw, type-asserts to *sqlite3.SQLiteConn, enables extension loading on that conn, and calls LoadExtension.
Because Store pins MaxOpenConns=1 (SQLite WAL semantics), loading on the single pooled connection is sufficient. If in the future the pool grows, callers should re-register via a ConnectHook instead.
Returns ErrExtensionMissing / ErrExtensionEmpty on placeholder builds so callers can fall back to brute-force cleanly.
Types ¶
This section is empty.