-
-
Notifications
You must be signed in to change notification settings - Fork 185
Open
Description
Can we provide a public function MarshalStruct for external calls, in case the caller just needs to add some extra fields to the marshal process but doesn't want to actually handle the marshal process himself?
For example:
// dynamodb table
type Item struct {
PK string `dynamo:",hash"`
}
type User struct {
Username string
Email string
}
type UserItem struct {
*Item
*User
}
// We want to add PK automatically in the marshal process
func (u *User) MarshalDynamoItem() (map[string]*dynamodb.AttributeValue, error) {
return dynamo.MarshalStruct(&UserItem{&Item{PK:"U#"+u.Username}, u})
}guregu
Metadata
Metadata
Assignees
Labels
No labels