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
This commit is contained in:
@@ -58,9 +58,6 @@ func startLighthousePostgres(ctx context.Context) error {
|
||||
postgres.WithUsername("lighthouse"),
|
||||
postgres.WithPassword("lighthouse"),
|
||||
postgres.BasicWaitStrategies(),
|
||||
testcontainers.WithEnv(map[string]string{
|
||||
"POSTGRES_INITDB_ARGS": "--locale-provider=icu --icu-locale=pl-PL --encoding=UTF8",
|
||||
}),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -106,14 +103,14 @@ func adminDB(t *testing.T) *sql.DB {
|
||||
return lhSQL
|
||||
}
|
||||
|
||||
// migratedDB returns a dedicated ICU pl-PL database migrated with
|
||||
// migratedDB returns a dedicated database migrated with
|
||||
// lagoon.Migrate (River v7 and summer_jobs) plus its DSN.
|
||||
func migratedDB(t *testing.T) (*sql.DB, string) {
|
||||
t.Helper()
|
||||
admin := adminDB(t)
|
||||
ctx := t.Context()
|
||||
name := fmt.Sprintf("lighthouse_%d", dbSeq.Add(1))
|
||||
if _, err := admin.ExecContext(ctx, `CREATE DATABASE `+name+` TEMPLATE template0 ENCODING 'UTF8' LOCALE_PROVIDER icu ICU_LOCALE 'pl-PL'`); err != nil && !strings.Contains(err.Error(), "already exists") {
|
||||
if _, err := admin.ExecContext(ctx, `CREATE DATABASE `+name+` TEMPLATE template0 ENCODING 'UTF8'`); err != nil && !strings.Contains(err.Error(), "already exists") {
|
||||
t.Fatalf("create %s: %v", name, err)
|
||||
}
|
||||
dsn, err := dsnWithDB(lhDSN, name)
|
||||
|
||||
Reference in New Issue
Block a user