Merge pull request #158 from bblagojevic94/mainflux-157

Export normalize method from writer service inside cassandra package
This commit is contained in:
Drasko DRASKOVIC 2018-02-10 17:50:18 +01:00 committed by GitHub
commit 6d9c92596c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -17,7 +17,9 @@ func NewMessageRepository(session *gocql.Session) writer.MessageRepository {
return &msgRepository{session}
}
func normalize(msg writer.RawMessage) ([]writer.Message, error) {
// Normalize decodes and normalizes message emitted by the mainflux adapters layer
// into Message structure. A non-nil error is returned to indicate operation failure.
func Normalize(msg writer.RawMessage) ([]writer.Message, error) {
var (
rm, nm senml.SenML // raw and normalized message
err error
@ -68,7 +70,7 @@ func (repo *msgRepository) Save(raw writer.RawMessage) error {
err error
)
if msgs, err = normalize(raw); err != nil {
if msgs, err = Normalize(raw); err != nil {
return err
}