1
0
justguestbook/guestbook/reply.go

24 lines
409 B
Go

package guestbook
import (
"errors"
"time"
)
type Reply struct {
ID int64 `json:"-"`
Created time.Time `json:"created,omitempty"`
Message string `json:"message"`
}
func NewReply(entryID int64, message string) (*Reply, error) {
if message == "" {
return nil, errors.New("empty reply field")
}
return &Reply{
ID: entryID,
Created: time.Now().UTC(),
Message: message}, nil
}