SQLite key-value store wrapper
Find a file
Virgil a458464876
All checks were successful
Security Scan / security (push) Successful in 10s
Test / test (push) Successful in 1m42s
docs(store): add field usage examples
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-30 16:50:04 +00:00
.core chore: add .core/ build and release configs 2026-03-06 18:52:37 +00:00
.forgejo/workflows ci: add Forgejo Actions test and security scan workflows 2026-02-23 03:28:08 +00:00
.github/workflows ci: add Core ecosystem CI workflow with CodeRabbit auto-fix 2026-03-17 14:05:30 +00:00
docs docs(ax): align CLAUDE with AX examples 2026-03-30 16:46:18 +00:00
.editorconfig chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig) 2026-02-23 06:45:49 +00:00
.gitignore chore: add .core/ and .idea/ to .gitignore 2026-03-15 10:17:50 +00:00
.golangci.yml chore(repo): enforce AX review conventions 2026-03-26 11:17:06 +00:00
bench_test.go refactor(store): tighten AX docs and helpers 2026-03-30 16:33:07 +00:00
CLAUDE.md docs(ax): align CLAUDE with AX examples 2026-03-30 16:46:18 +00:00
CODEX.md docs(ax): add Codex conventions bridge 2026-03-30 15:16:16 +00:00
CONTRIBUTING.md chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig) 2026-02-23 06:45:49 +00:00
conventions_test.go docs(ax): add Codex conventions bridge 2026-03-30 15:16:16 +00:00
coverage_test.go refactor(store): rename sqlite schema for AX clarity 2026-03-30 15:37:49 +00:00
doc.go refactor(store): tighten AX examples and error handling 2026-03-30 16:41:56 +00:00
events.go docs(store): add field usage examples 2026-03-30 16:50:04 +00:00
events_test.go refactor(store): tighten AX event naming and examples 2026-03-30 16:07:53 +00:00
go.mod chore(deps): remove stale core/log dependency 2026-03-29 23:27:16 +00:00
go.sum chore(deps): remove stale core/log dependency 2026-03-29 23:27:16 +00:00
README.md refactor(store): tighten AX examples and error handling 2026-03-30 16:41:56 +00:00
scope.go refactor(store): tighten AX examples and error handling 2026-03-30 16:41:56 +00:00
scope_test.go refactor(store): adopt AX primary names 2026-03-30 14:22:49 +00:00
store.go docs(store): add field usage examples 2026-03-30 16:50:04 +00:00
store_test.go refactor(store): tighten AX error context and examples 2026-03-30 16:27:54 +00:00
test_helpers_test.go docs(ax): add Codex conventions bridge 2026-03-30 15:16:16 +00:00

Go Reference License: EUPL-1.2 Go Version

go-store

Group-namespaced SQLite key-value store with TTL expiry, namespace isolation, quota enforcement, and a reactive event system. Backed by a pure-Go SQLite driver (no CGO), uses WAL mode for concurrent reads, and enforces a single connection to keep pragma settings consistent. Supports scoped stores for multi-tenant use, Watch/Unwatch subscriptions, and OnChange callbacks for go-ws event streaming.

Module: dappco.re/go/core/store Licence: EUPL-1.2 Language: Go 1.26

Quick Start

package main

import (
	"fmt"
	"time"

	"dappco.re/go/core/store"
)

func main() {
	storeInstance, err := store.New("/path/to/store.db") // or store.New(":memory:")
	if err != nil {
		return
	}
	defer storeInstance.Close()

	if err := storeInstance.Set("config", "theme", "dark"); err != nil {
		return
	}
	if err := storeInstance.SetWithTTL("session", "token", "abc123", 24*time.Hour); err != nil {
		return
	}
	themeValue, err := storeInstance.Get("config", "theme")
	if err != nil {
		return
	}
	fmt.Println(themeValue)

	// Watch for mutations
	watcher := storeInstance.Watch("config", "*")
	defer storeInstance.Unwatch(watcher)
	go func() {
		for event := range watcher.Events {
			fmt.Println(event.Type, event.Group, event.Key, event.Value)
		}
	}()

	// Scoped store for tenant isolation
	scopedStore, err := store.NewScoped(storeInstance, "tenant-42")
	if err != nil {
		return
	}
	if err := scopedStore.Set("prefs", "locale", "en-GB"); err != nil {
		return
	}
}

Documentation

  • Agent Conventions - Codex-facing repo rules and AX notes
  • Architecture — storage layer, group/key model, TTL expiry, event system, namespace isolation
  • Development Guide — prerequisites, test patterns, benchmarks, adding methods
  • Project History — completed phases, known limitations, future considerations

Build & Test

go test ./...
go test -race ./...
go test -bench=. ./...
go build ./...

Licence

European Union Public Licence 1.2 — see LICENCE for details.