restructure project, add claudemd

This commit is contained in:
2026-07-08 16:36:17 -04:00
parent a7964f9410
commit 2a5fbffaa2
315 changed files with 81075 additions and 0 deletions

25
go/dbutil/registry.go Normal file
View File

@@ -0,0 +1,25 @@
package dbutil
import "reflect"
// tableRegistry maps a model struct type to its database table name. The query
// builder (T[M]) resolves table names through it, so the framework never has to
// import the application's models package. Apps populate it once at startup via
// Register / RegisterAll — typically from an init() in their models package:
//
// func init() { dbutil.RegisterAll(Tables) }
var tableRegistry = map[reflect.Type]string{}
// Register maps a single model type to a table name.
func Register(t reflect.Type, name string) { tableRegistry[t] = name }
// RegisterAll merges a whole type->table map (e.g. an app's models.Tables) into
// the registry.
func RegisterAll(m map[reflect.Type]string) {
for k, v := range m {
tableRegistry[k] = v
}
}
// tableNameFor returns the registered table name for t, or "" if none is set.
func tableNameFor(t reflect.Type) string { return tableRegistry[t] }