func (p *MerchantTransactions) UnmarshalBinary(data []byte) error {
	return json.Unmarshal(data, p)
}
To allow Redis to use this struct directly in marshaling
package dashboard
import (
	"encoding/json"
	"github.com/adonese/noebs/ebs_fields"
	"github.com/gin-contrib/multitemplate"
	"github.com/gin-gonic/gin"
	"github.com/jinzhu/gorm"
	"strings"
	"time"
	"unicode"
)
type Transaction struct {
	gorm.Model
	ebs_fields.GenericEBSResponseFields
}
type PurchaseModel struct {
	gorm.Model
	ebs_fields.PurchaseFields
}
type Env struct {
	Db *gorm.DB
}
func (e *Env) GetTransactionbyID(c *gin.Context) {
	var tran Transaction
	err := e.Db.Find(&tran).Error
	if err != nil {
		c.AbortWithStatus(404)
	}
	c.JSON(200, gin.H{"result": tran.ID})
	defer e.Db.Close()
}
type MerchantTransactions struct {
	PurchaseAmount         float32 `json:"purchase_amount"`
	AllTransactions        int     `json:"purchases_count"`
	SuccessfulTransactions int     `json:"successful_transactions"`
	FailedTransactions     int     `json:"failed_transactions"`
}
func (p *MerchantTransactions) MarshalBinary() ([]byte, error) {
	return json.Marshal(p)
}