ragitschema

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package ragitschema is ragit's schema declaration: the single source of truth from which its migrations and models are generated.

It lives in its own package because the declarations here and the model structs generated from them share names — ragitschema.Document is the table declaration, ragit.Document is the row struct.

Why this is a function and not a set of package-level vars

The embedding dimension is a column type, not a runtime setting: a vector(1536) column refuses a 768-component value, and changing it means re-embedding the whole corpus. Declaring the schema through New makes the dimension a value passed in rather than a literal baked into a shipped .sql file that a consumer would have to fork. See ragit.Migrate for how a deployment that wants a different width renders its own migration set.

Index

Constants

View Source
const DefaultEmbeddingDimension = 1536

DefaultEmbeddingDimension is the width ragit's shipped migrations declare. It matches embed.DefaultDimension.

View Source
const ModuleName = "ragit"

ModuleName prefixes every table ragit owns. sqlb applies it at the registry rather than in each declaration, so table ownership is visible in the database and cannot be forgotten — which is the point, since these tables live in a host application's schema alongside its own and River's.

Variables

This section is empty.

Functions

This section is empty.

Types

type Schema

type Schema struct {
	Registry *schema.Registry
	Document *schema.TableDef
	Chunk    *schema.TableDef
	// Dimension is the embedding width this declaration was built for.
	Dimension int
}

Schema holds ragit's declaration and the tables within it.

func New

func New(dimension int) *Schema

New builds the schema for a given embedding dimension.

A fresh registry per call rather than package-level vars: two callers wanting different dimensions (a test and a deployment, say) must not fight over one global, and sqlb panics on a table registered twice.

Jump to

Keyboard shortcuts

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