func (o *Order) MarshalRedis() (string, map[string]int) {
	id := strconv.FormatInt(o.ID, 10)
	if o.Items == nil {
		return id, nil
	}
	items := make(map[string]int)
	for _, v := range o.Items {
		items[v.ID] = v.Qty
	}
	return id, items
}
MarshalRedis marshals an Order to hand over to go-redis.
package order
import (
	"context"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"sort"
	"strconv"
	"strings"
	"github.com/obitech/micro-obs/item"
	"github.com/obitech/micro-obs/util"
	ot "github.com/opentracing/opentracing-go"
	"github.com/opentracing/opentracing-go/ext"
	"github.com/pkg/errors"
)
type Order struct {
	ID    int64   `json:"id"`
	Items []*Item `json:"items"`
}
type Item struct {
	ID  string `json:"id"`
	Qty int    `json:"qty"`
}
type notFoundError struct {
	err string
}
func (e notFoundError) Error() string {
	return e.err
}
func (o *Order) String() string {
	return fmt.Sprintf("ID:%d Items:%+v", o.ID, o.Items)
}
func (i *Item) String() string {
	return fmt.Sprintf("ID:%s Qty:%d", i.ID, i.Qty)
}
func NewItem(item *item.Item) (*Item, error) {
	return &Item{
		ID:  item.ID,
		Qty: item.Qty,
	}, nil
}
func (o *Order) Sort() error {
	if o.Items == nil || len(o.Items) == 0 {
		return errors.New("order needs items")
	}
	sort.Slice(o.Items, func(i, j int) bool {
		return strings.Compare(o.Items[i].ID, o.Items[j].ID) == -1
	})
	return nil
}
func NewOrder(id int64, items ...*Item) (*Order, error) {
	oi := make([]*Item, len(items))
	for i, v := range items {
		if v == nil {
			return nil, errors.New("order needs items")
		}
		oi[i] = v
	}
	order := &Order{
		ID:    id,
		Items: oi,
	}
	order.Sort()
	return order, nil
}