2017-11-02 19:37:07 +00:00
|
|
|
package observers
|
2017-10-25 15:57:59 +00:00
|
|
|
|
|
|
|
import (
|
2017-11-02 19:37:07 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/core"
|
2017-11-03 13:01:35 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/repositories"
|
2017-10-25 15:57:59 +00:00
|
|
|
"github.com/jmoiron/sqlx"
|
|
|
|
)
|
|
|
|
|
|
|
|
type BlockchainDBObserver struct {
|
|
|
|
Db *sqlx.DB
|
|
|
|
}
|
|
|
|
|
2017-11-02 19:37:07 +00:00
|
|
|
func (observer BlockchainDBObserver) NotifyBlockAdded(block core.Block) {
|
2017-11-03 13:01:35 +00:00
|
|
|
repositories.NewPostgres(observer.Db).CreateBlock(block)
|
2017-10-25 15:57:59 +00:00
|
|
|
}
|