Skip to content

Commit

Permalink
Godoc fix
Browse files Browse the repository at this point in the history
  • Loading branch information
FedorLap2006 committed Jun 18, 2021
1 parent 9b358e5 commit 516644f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components.go
Expand Up @@ -20,10 +20,13 @@ type MessageComponent interface {
Type() ComponentType
}

// UnmarshableMessageComponent is just a helper for components which need ability to be unmarshaled (like the ones in messages).
// Since MessageComponent is an interface - json.Unmarshal can't unmarshal it properly.
type UnmarshableMessageComponent struct {
MessageComponent
}

// UnmarshalJSON is a helper function to unmarshal MessageComponent object.
func (umc *UnmarshableMessageComponent) UnmarshalJSON(src []byte) (err error) {
var v struct {
Type ComponentType `json:"type"`
Expand Down

0 comments on commit 516644f

Please sign in to comment.