Skip to content

Instantly share code, notes, and snippets.

@kamal-kambe
Last active August 6, 2019 07:14
Show Gist options
  • Save kamal-kambe/e40c05adcd4101362ba4c34e2ac67860 to your computer and use it in GitHub Desktop.
Save kamal-kambe/e40c05adcd4101362ba4c34e2ac67860 to your computer and use it in GitHub Desktop.
package service
import (
"encoding/json"
)
type Base interface {
GetData() json.RawMessage
}
type base struct {
bRepo BaseRepository
cache Cache
}
func (f *baseFactory) NewBase() Base {
return &base{
bRepo: f.NewBaseRepository(),
cache: f.cache,
}
}
func (b *base) GetData() json.RawMessage {
data := make(map[string]interface{})
updatedModels := b.bRepo.GetUpdatedModels()
data["market_data"] := b.bRepo.GetRows(updatedModels)
jsonData, _ := json.Marshal(data)
return jsonData
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment