From a751dd88cb64e631a146e4a9f681a339ab011c13 Mon Sep 17 00:00:00 2001 From: bradub Date: Fri, 10 Jan 2025 13:02:29 +0200 Subject: [PATCH] feat(psqlutil): use the error translator by default when opening a gorm db --- psqlutil/psql_open.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/psqlutil/psql_open.go b/psqlutil/psql_open.go index e3d0f88..d1a72e3 100644 --- a/psqlutil/psql_open.go +++ b/psqlutil/psql_open.go @@ -53,6 +53,10 @@ func GormOpen( return nil, fmt.Errorf("open db: %w", err) } + if err := db.Use(GORMErrorsPlugin{}); err != nil { + return nil, fmt.Errorf("use gorm errors plugin: %w", err) + } + return db, nil }