package domain import "time" type Institution struct { ID int64 `json:"id"` Name string `json:"name"` ShortName string `json:"short_name"` Created int64 `json:"created"` } type History struct { ID int64 `json:"id"` Institution Institution `json:"institution"` Compra float64 `json:"compra"` Venta float64 `json:"venta"` Parser string `json:"parser"` Parsed int64 `json:"parsed"` } type Change struct { Before History `json:"before"` After History `json:"after"` } type Message struct { Message string `json:"message"` Data *Change `json:"data"` Error error `json:"error"` } func NewHistory(name, parser, shortname string, compra, venta float64) History { return History{ Institution: Institution{ Name: name, ShortName: shortname, Created: time.Now().Unix(), }, Parser: parser, Compra: compra, Venta: venta, Parsed: time.Now().Unix(), } } func NewInstitution(name, shortname string) Institution { return Institution{ Name: name, ShortName: shortname, Created: time.Now().Unix(), } } func NewChange(before, after History) *Change { return &Change{ Before: before, After: after, } } func NewMessage(message string, data *Change, err error) *Message { return &Message{ Message: message, Data: data, Error: err, } }