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
pull/2/head
Vinícius Garcia 2021-03-04 22:24:13 -03:00
parent 6f1885d3a0
commit ff4952da65
2 changed files with 10 additions and 0 deletions

View File

@ -250,6 +250,7 @@ ok github.com/vingarcia/kissorm 21.740s
- Improve error messages - Improve error messages
- Add tests for tables using composite keys - Add tests for tables using composite keys
- Add support for serializing structs as other formats such as YAML - Add support for serializing structs as other formats such as YAML
- Update structs.FillStructWith to work with `json` tagged attributes
### Optimizations Oportunities ### Optimizations Oportunities

View File

@ -30,6 +30,15 @@ type UserEntity struct {
Age *int `kissorm:"age"` Age *int `kissorm:"age"`
Score *int `kissorm:"score"` Score *int `kissorm:"score"`
LastPayment time.Time `kissorm:"last_payment"` 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 ... // NewUserService ...