From 6fa3e99be2abd3912ec05b6647eb45dda20c9345 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Thu, 22 Jun 2023 21:54:39 +0300 Subject: [PATCH] use inflector.UcFirst instead of strings.Title --- plugins/jsvm/vm.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/jsvm/vm.go b/plugins/jsvm/vm.go index 3a0bf6d2..73aad551 100644 --- a/plugins/jsvm/vm.go +++ b/plugins/jsvm/vm.go @@ -22,7 +22,6 @@ import ( "path/filepath" "reflect" "regexp" - "strings" "github.com/dop251/goja" validation "github.com/go-ozzo/ozzo-validation/v4" @@ -35,6 +34,7 @@ import ( "github.com/pocketbase/pocketbase/models/schema" "github.com/pocketbase/pocketbase/tokens" "github.com/pocketbase/pocketbase/tools/filesystem" + "github.com/pocketbase/pocketbase/tools/inflector" "github.com/pocketbase/pocketbase/tools/mailer" "github.com/pocketbase/pocketbase/tools/security" "github.com/pocketbase/pocketbase/tools/types" @@ -454,7 +454,7 @@ func newDynamicModel(shape map[string]any) any { shapeValues = append(shapeValues, reflect.ValueOf(v)) structFields = append(structFields, reflect.StructField{ - Name: strings.Title(k), // ensures that the field is exportable + Name: inflector.UcFirst(k), // ensures that the field is exportable Type: vt, Tag: reflect.StructTag(`db:"` + k + `" json:"` + k + `" form:"` + k + `"`), })