db.go.tmpl

15 lines
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
package models

import (
	"<<.Module>>/internal/database"
	"<<.Module>>/internal/database/engines"
)

// DB picks the engine from environment:
//   DB_URL + DB_TOKEN → remote LibSQL replica
//   DB_PATH           → local SQLite file with WAL
//   neither           → in-memory (development/testing)
var DB = engines.NewAuto()

// Collections — each manages one table, auto-created on startup.
var Items = database.Manage(DB, new(Item))