Fix struct tag with spaces as values ()

This commit is contained in:
sunboyy 2023-04-19 19:42:08 +07:00 committed by GitHub
parent bdb63c8129
commit 021de6214c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 38 additions and 86 deletions
internal/generator

View file

@ -14,17 +14,17 @@ var (
idField = code.StructField{
Name: "ID",
Type: code.ExternalType{PackageAlias: "primitive", Name: "ObjectID"},
Tags: map[string][]string{"bson": {"_id", "omitempty"}},
Tag: `bson:"_id,omitempty"`,
}
genderField = code.StructField{
Name: "Gender",
Type: code.SimpleType("Gender"),
Tags: map[string][]string{"bson": {"gender"}},
Tag: `bson:"gender"`,
}
ageField = code.StructField{
Name: "Age",
Type: code.TypeInt,
Tags: map[string][]string{"bson": {"age"}},
Tag: `bson:"age"`,
}
)
@ -36,7 +36,7 @@ func TestGenerateMongoRepository(t *testing.T) {
code.StructField{
Name: "Username",
Type: code.TypeString,
Tags: map[string][]string{"bson": {"username"}},
Tag: `bson:"username"`,
},
genderField,
ageField,