store

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package store is WittyPlay's own database (module API 5): a SQLite file in the module's own folder (WITTYMODULE_DATA), with migrations WittyPlay owns. It refers to the server's item and user ids as they are.

Index

Constants

View Source
const File = "wittyplay.db"

File is the database's name in the module's folder.

Variables

This section is empty.

Functions

func Register

func Register(ms ...Migration)

Register adds migrations; each part of WittyPlay that keeps data registers its own.

Types

type DB

type DB struct {
	*sql.DB
	// contains filtered or unexported fields
}

DB is WittyPlay's database.

func Open

func Open(dir string) (*DB, error)

Open opens (or makes) the database in dir and brings its schema up to date.

func (*DB) Meta

func (d *DB) Meta(ctx context.Context, key string) string

Meta reads and writes a little of the store's own bookkeeping.

func (*DB) SetMeta

func (d *DB) SetMeta(ctx context.Context, key, value string) error

func (*DB) Version

func (d *DB) Version(ctx context.Context) int

Version is the schema's version now.

type Migration

type Migration struct {
	Version int
	SQL     string
}

Migration is one step of the schema, applied once, in order of Version.

Jump to

Keyboard shortcuts

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