vss

package module
v0.0.0-...-8fb131c Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 3 Imported by: 0

README

sqlite-vss Go package

This package wraps the go-sqlite3 driver and automatically loads extensions when opening a database connection.

package main

import (
	"fmt"
	"log"

	vss "github.com/asg017/sqlite-vss"
)

func main() {
	// /usr/local/lib/sqlite/ext/sqlite-vss is where vss0 and vector0 are stored.
	db, err := vss.Open("vss-example.db", "/usr/local/lib/sqlite/ext/sqlite-vss")
	if err != nil {
		log.Fatal()
	}
	defer db.Close()

	r := db.QueryRow("select vss_version(), vss();")
	if err := r.Err(); err != nil {
		log.Fatal(err)
	}

	var versions any
	if err := r.Scan(&versions); err != nil {
		log.Fatal(err)
	}

	fmt.Println(versions)
}

Installing

go install github.com/asg017/sqlite-vss

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(dbName string, extPath string) (*sql.DB, error)

Open returns a sql.DB pre-configured with sqlite-vss extensions, to work vss0 and vector0 files should be stored under extPath.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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