From 013f781b299e8eb8dc03e56109c0d5c5404d35a3 Mon Sep 17 00:00:00 2001 From: royalcat Date: Wed, 24 May 2023 13:51:55 +0300 Subject: [PATCH] [CRUTCH] json tag --- internal/mongo/common.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/mongo/common.go b/internal/mongo/common.go index b47d5a8..15a1f72 100644 --- a/internal/mongo/common.go +++ b/internal/mongo/common.go @@ -67,7 +67,10 @@ func (g baseMethodGenerator) bsonFieldReference(fieldReference spec.FieldReferen func (g baseMethodGenerator) bsonTagFromField(field code.StructField) (string, error) { bsonTag, ok := field.Tag.Lookup("bson") if !ok { - return "", NewBsonTagNotFoundError(field.Name) + bsonTag, ok = field.Tag.Lookup("json") + if !ok { + return "", NewBsonTagNotFoundError(field.Name) + } } documentKey := strings.Split(bsonTag, ",")[0]