Files
summercms/modules/lagoon/export_docs_test.go
Jakub Zych 037dc53030 feat(lagoon): per-query collation for OrderBy, drop the database locale check
- lagoon.OrderBy takes variadic lagoon.OrderOption values; lagoon.Collate(name)
  emits a validated, double-quoted COLLATE clause (e.g. "pl-x-icu")
- remove the exported CheckLocale and the ICU pl-PL check from Open and Use
- framework test containers and per-test databases are plain PostgreSQL
- lagoon README, root README and docs pages drop the locale requirement;
  queries-and-pagination gains a "Sorting with a collation" section
  backed by ExampleCollate
2026-10-01 09:51:03 +02:00

22 lines
505 B
Go

package lagoon
import (
"testing"
"gorm.io/gorm"
)
// DocsDB returns a GORM handle on a fresh database named name in this
// package's Postgres harness, for the database-backed docs examples in
// example_test.go. It skips under -short and fails when the harness has no
// database, like the package's other database tests.
func DocsDB(t *testing.T, name string) *gorm.DB {
t.Helper()
db, _ := dedicatedDB(t, name)
gdb, err := Use(t.Context(), db)
if err != nil {
t.Fatal(err)
}
return gdb
}