[CRUTCH] json tag

This commit is contained in:
royalcat 2023-05-24 13:51:55 +03:00
parent d2338b8f46
commit 013f781b29

View file

@ -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]