db

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Schema string = `` /* 364-byte string literal not displayed */

Functions

This section is empty.

Types

type DB

type DB interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Fragment

type Fragment struct {
	ID              int       `db:"id" json:"id"`
	Label           string    `db:"label" json:"label"`
	Name            string    `db:"name" json:"name"`
	Content         string    `db:"content" json:"content"`
	EmbeddingModel  string    `db:"embedding_model" json:"embedding_model"`
	EmbeddingVector []float64 `db:"embedding_vector" json:"embedding_vector"`
	CreatedAt       int       `db:"created_at" json:"created_at"`
	UpdatedAt       int       `db:"updated_at" json:"updated_at"`
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DB) *Queries

func (*Queries) AddFragment

func (q *Queries) AddFragment(
	ctx context.Context,
	label string,
	name string,
	content string,
	embeddingModel string,
	embeddingVector []float64,
) (Fragment, error)

func (*Queries) DirtyFragment

func (q *Queries) DirtyFragment(ctx context.Context, label string, name string, content string) (bool, error)

func (*Queries) KNN

func (q *Queries) KNN(ctx context.Context, vector []float64, label string, limit int) ([]Fragment, error)

func (*Queries) ListFragments

func (q *Queries) ListFragments(ctx context.Context) ([]Fragment, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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