You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
400 B
16 lines
400 B
package messagelog
|
|
|
|
import "gopkg.in/validator.v2"
|
|
|
|
type Message struct {
|
|
Index int `json:"index"`
|
|
Sender string `json:"sender" validate:"min=1"`
|
|
ContentType string `json:"content_type" validate:"min=1"`
|
|
Content interface{} `json:"content" validate:"nonnil"`
|
|
}
|
|
|
|
func (m Message) validate() error {
|
|
// TODO: Use ErrInvalidMessage!
|
|
return validator.Validate(m)
|
|
}
|