From ff4952da65ce65207289ca29a001cf6598a31da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Garcia?= Date: Thu, 4 Mar 2021 22:24:13 -0300 Subject: [PATCH] Partially update example_service to include the JSON feature Its only partial because currently the function `structs.FillStructWith` doesn't support the attributes tagged as `kissorm:"?,json"` The task of updating the FillStructWith was updated to include this behavior --- README.md | 1 + examples/example_service/example_service.go | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index b9b69dd..363f3e9 100644 --- a/README.md +++ b/README.md @@ -250,6 +250,7 @@ ok github.com/vingarcia/kissorm 21.740s - Improve error messages - Add tests for tables using composite keys - Add support for serializing structs as other formats such as YAML +- Update structs.FillStructWith to work with `json` tagged attributes ### Optimizations Oportunities diff --git a/examples/example_service/example_service.go b/examples/example_service/example_service.go index ae8ff65..8347228 100644 --- a/examples/example_service/example_service.go +++ b/examples/example_service/example_service.go @@ -30,6 +30,15 @@ type UserEntity struct { Age *int `kissorm:"age"` Score *int `kissorm:"score"` LastPayment time.Time `kissorm:"last_payment"` + Address *Address `kissorm:"address,json"` +} + +// Address contains the user's address +type Address struct { + AddrLines []string `json:"addr_lines"` + City string `json:"city"` + State string `json:"state"` + Country string `json:"country"` } // NewUserService ...