Extract common repository methods
- Inject column names to reduce duplication across common behavior - Extract checked headers column names to constants
This commit is contained in:
parent
8c168ed332
commit
0b58efb56a
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type CatFileChopLumpRepository struct {
|
||||
@ -47,10 +49,8 @@ func (repository CatFileChopLumpRepository) Create(headerID int64, models []inte
|
||||
return err
|
||||
}
|
||||
}
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, cat_file_chop_lump_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET cat_file_chop_lump_checked = $2`, headerID, true)
|
||||
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.CatFileChopLumpChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -59,28 +59,11 @@ func (repository CatFileChopLumpRepository) Create(headerID int64, models []inte
|
||||
}
|
||||
|
||||
func (repository CatFileChopLumpRepository) MarkHeaderChecked(headerID int64) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO public.checked_headers (header_id, cat_file_chop_lump_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET cat_file_chop_lump_checked = $2`, headerID, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerID, repository.db, constants.CatFileChopLumpChecked)
|
||||
}
|
||||
|
||||
func (repository CatFileChopLumpRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
err := repository.db.Select(
|
||||
&result,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR cat_file_chop_lump_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
repository.db.Node.ID,
|
||||
)
|
||||
return result, err
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.CatFileChopLumpChecked)
|
||||
}
|
||||
|
||||
func (repository *CatFileChopLumpRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/chop_lump"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
@ -43,7 +44,7 @@ var _ = Describe("Cat file chop lump repository", func() {
|
||||
modelWithDifferentLogIdx := test_data.CatFileChopLumpModel
|
||||
modelWithDifferentLogIdx.LogIndex++
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "cat_file_chop_lump_checked",
|
||||
CheckedHeaderColumnName: constants.CatFileChopLumpChecked,
|
||||
LogEventTableName: "maker.cat_file_chop_lump",
|
||||
TestModel: test_data.CatFileChopLumpModel,
|
||||
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
|
||||
@ -73,7 +74,7 @@ var _ = Describe("Cat file chop lump repository", func() {
|
||||
|
||||
Describe("MarkHeaderChecked", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "cat_file_chop_lump_checked",
|
||||
CheckedHeaderColumnName: constants.CatFileChopLumpChecked,
|
||||
Repository: &catFileRepository,
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type CatFileFlipRepository struct {
|
||||
@ -46,11 +48,8 @@ func (repository CatFileFlipRepository) Create(headerID int64, models []interfac
|
||||
return err
|
||||
}
|
||||
}
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, cat_file_flip_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET cat_file_flip_checked = $2`, headerID, true)
|
||||
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.CatFileFlipChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -59,28 +58,11 @@ func (repository CatFileFlipRepository) Create(headerID int64, models []interfac
|
||||
}
|
||||
|
||||
func (repository CatFileFlipRepository) MarkHeaderChecked(headerID int64) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO public.checked_headers (header_id, cat_file_flip_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET cat_file_flip_checked = $2`, headerID, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerID, repository.db, constants.CatFileFlipChecked)
|
||||
}
|
||||
|
||||
func (repository CatFileFlipRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
err := repository.db.Select(
|
||||
&result,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR cat_file_flip_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
repository.db.Node.ID,
|
||||
)
|
||||
return result, err
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.CatFileFlipChecked)
|
||||
}
|
||||
|
||||
func (repository *CatFileFlipRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/flip"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
@ -47,7 +48,7 @@ var _ = Describe("Cat file flip repository", func() {
|
||||
catFileFlipWithDifferentIdx := test_data.CatFileFlipModel
|
||||
catFileFlipWithDifferentIdx.LogIndex++
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "cat_file_flip_checked",
|
||||
CheckedHeaderColumnName: constants.CatFileFlipChecked,
|
||||
LogEventTableName: "maker.cat_file_flip",
|
||||
TestModel: test_data.CatFileFlipModel,
|
||||
ModelWithDifferentLogIdx: catFileFlipWithDifferentIdx,
|
||||
@ -76,7 +77,7 @@ var _ = Describe("Cat file flip repository", func() {
|
||||
|
||||
Describe("MarkHeaderChecked", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "cat_file_flip_checked",
|
||||
CheckedHeaderColumnName: constants.CatFileFlipChecked,
|
||||
Repository: &catFileFlipRepository,
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type CatFilePitVowRepository struct {
|
||||
@ -46,10 +48,8 @@ func (repository CatFilePitVowRepository) Create(headerID int64, models []interf
|
||||
return err
|
||||
}
|
||||
}
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, cat_file_pit_vow_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET cat_file_pit_vow_checked = $2`, headerID, true)
|
||||
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.CatFilePitVowChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -58,28 +58,11 @@ func (repository CatFilePitVowRepository) Create(headerID int64, models []interf
|
||||
}
|
||||
|
||||
func (repository CatFilePitVowRepository) MarkHeaderChecked(headerID int64) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO public.checked_headers (header_id, cat_file_pit_vow_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET cat_file_pit_vow_checked = $2`, headerID, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerID, repository.db, constants.CatFilePitVowChecked)
|
||||
}
|
||||
|
||||
func (repository CatFilePitVowRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
err := repository.db.Select(
|
||||
&result,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR cat_file_pit_vow_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
repository.db.Node.ID,
|
||||
)
|
||||
return result, err
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.CatFilePitVowChecked)
|
||||
}
|
||||
|
||||
func (repository *CatFilePitVowRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/pit_vow"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
@ -47,7 +48,7 @@ var _ = Describe("Cat file pit vow repository", func() {
|
||||
modelWithDifferentLogIdx := test_data.CatFilePitVowModel
|
||||
modelWithDifferentLogIdx.LogIndex++
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "cat_file_pit_vow_checked",
|
||||
CheckedHeaderColumnName: constants.CatFilePitVowChecked,
|
||||
LogEventTableName: "maker.cat_file_pit_vow",
|
||||
TestModel: test_data.CatFilePitVowModel,
|
||||
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
|
||||
@ -75,7 +76,7 @@ var _ = Describe("Cat file pit vow repository", func() {
|
||||
|
||||
Describe("MarkHeaderChecked", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "cat_file_pit_vow_checked",
|
||||
CheckedHeaderColumnName: constants.CatFilePitVowChecked,
|
||||
Repository: &catFilePitVowRepository,
|
||||
}
|
||||
shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs)
|
||||
|
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type DealRepository struct {
|
||||
@ -47,11 +49,8 @@ func (repository DealRepository) Create(headerId int64, models []interface{}) er
|
||||
return err
|
||||
}
|
||||
}
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, deal_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET deal_checked = $2`, headerId, true)
|
||||
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerId, tx, constants.DealChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -60,27 +59,11 @@ func (repository DealRepository) Create(headerId int64, models []interface{}) er
|
||||
}
|
||||
|
||||
func (repository DealRepository) MarkHeaderChecked(headerID int64) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO public.checked_headers (header_id, deal_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET deal_checked = $2`, headerID, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerID, repository.db, constants.DealChecked)
|
||||
}
|
||||
|
||||
func (repository DealRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var missingHeaders []core.Header
|
||||
err := repository.db.Select(&missingHeaders,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR deal_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
repository.db.Node.ID,
|
||||
)
|
||||
return missingHeaders, err
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DealChecked)
|
||||
}
|
||||
|
||||
func (repository *DealRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/deal"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
@ -46,7 +47,7 @@ var _ = Describe("Deal Repository", func() {
|
||||
modelWithDifferentLogIdx := test_data.DealModel
|
||||
modelWithDifferentLogIdx.LogIndex = modelWithDifferentLogIdx.LogIndex + 1
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "deal_checked",
|
||||
CheckedHeaderColumnName: constants.DealChecked,
|
||||
LogEventTableName: "maker.deal",
|
||||
TestModel: test_data.DealModel,
|
||||
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
|
||||
@ -77,7 +78,7 @@ var _ = Describe("Deal Repository", func() {
|
||||
|
||||
Describe("MarkHeaderChecked", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "deal_checked",
|
||||
CheckedHeaderColumnName: constants.DealChecked,
|
||||
Repository: &dealRepository,
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type DentRepository struct {
|
||||
@ -48,10 +50,7 @@ func (r DentRepository) Create(headerId int64, models []interface{}) error {
|
||||
}
|
||||
}
|
||||
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, dent_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET dent_checked = $2`, headerId, true)
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerId, tx, constants.DentChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -60,30 +59,11 @@ func (r DentRepository) Create(headerId int64, models []interface{}) error {
|
||||
}
|
||||
|
||||
func (r DentRepository) MarkHeaderChecked(headerId int64) error {
|
||||
_, err := r.db.Exec(`INSERT INTO public.checked_headers (header_id, dent_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET dent_checked = $2`, headerId, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerId, r.db, constants.DentChecked)
|
||||
}
|
||||
|
||||
func (r DentRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var missingHeaders []core.Header
|
||||
|
||||
err := r.db.Select(
|
||||
&missingHeaders,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR dent_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
r.db.Node.ID,
|
||||
)
|
||||
|
||||
return missingHeaders, err
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, r.db, constants.DentChecked)
|
||||
}
|
||||
|
||||
func (repository *DentRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/dent"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
@ -46,7 +47,7 @@ var _ = Describe("Dent Repository", func() {
|
||||
modelWithDifferentLogIdx := test_data.DentModel
|
||||
modelWithDifferentLogIdx.LogIndex++
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "dent_checked",
|
||||
CheckedHeaderColumnName: constants.DentChecked,
|
||||
LogEventTableName: "maker.dent",
|
||||
TestModel: test_data.DentModel,
|
||||
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
|
||||
@ -81,7 +82,7 @@ var _ = Describe("Dent Repository", func() {
|
||||
|
||||
Describe("MarkHeaderChecked", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "dent_checked",
|
||||
CheckedHeaderColumnName: constants.DentChecked,
|
||||
Repository: &dentRepository,
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type DripDripRepository struct {
|
||||
@ -46,10 +48,8 @@ func (repository DripDripRepository) Create(headerID int64, models []interface{}
|
||||
return err
|
||||
}
|
||||
}
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, drip_drip_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET drip_drip_checked = $2`, headerID, true)
|
||||
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.DripDripChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -58,28 +58,11 @@ func (repository DripDripRepository) Create(headerID int64, models []interface{}
|
||||
}
|
||||
|
||||
func (repository DripDripRepository) MarkHeaderChecked(headerID int64) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO public.checked_headers (header_id, drip_drip_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET drip_drip_checked = $2`, headerID, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerID, repository.db, constants.DripDripChecked)
|
||||
}
|
||||
|
||||
func (repository DripDripRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
err := repository.db.Select(
|
||||
&result,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR drip_drip_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
repository.db.Node.ID,
|
||||
)
|
||||
return result, err
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DripDripChecked)
|
||||
}
|
||||
|
||||
func (repository *DripDripRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/drip_drip"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
@ -46,7 +47,7 @@ var _ = Describe("Drip drip repository", func() {
|
||||
modelWithDifferentLogIdx := test_data.DripDripModel
|
||||
modelWithDifferentLogIdx.LogIndex++
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "drip_drip_checked",
|
||||
CheckedHeaderColumnName: constants.DripDripChecked,
|
||||
LogEventTableName: "maker.drip_drip",
|
||||
TestModel: test_data.DripDripModel,
|
||||
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
|
||||
@ -73,7 +74,7 @@ var _ = Describe("Drip drip repository", func() {
|
||||
|
||||
Describe("MarkHeaderChecked", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "drip_drip_checked",
|
||||
CheckedHeaderColumnName: constants.DripDripChecked,
|
||||
Repository: &dripDripRepository,
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type DripFileIlkRepository struct {
|
||||
@ -48,10 +50,8 @@ func (repository DripFileIlkRepository) Create(headerID int64, models []interfac
|
||||
return err
|
||||
}
|
||||
}
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, drip_file_ilk_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET drip_file_ilk_checked = $2`, headerID, true)
|
||||
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.DripFileIlkChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -61,28 +61,11 @@ func (repository DripFileIlkRepository) Create(headerID int64, models []interfac
|
||||
}
|
||||
|
||||
func (repository DripFileIlkRepository) MarkHeaderChecked(headerID int64) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO public.checked_headers (header_id, drip_file_ilk_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET drip_file_ilk_checked = $2`, headerID, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerID, repository.db, constants.DripFileIlkChecked)
|
||||
}
|
||||
|
||||
func (repository DripFileIlkRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
err := repository.db.Select(
|
||||
&result,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR drip_file_ilk_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
repository.db.Node.ID,
|
||||
)
|
||||
return result, err
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DripFileIlkChecked)
|
||||
}
|
||||
|
||||
func (repository *DripFileIlkRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/ilk"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
@ -46,7 +47,7 @@ var _ = Describe("Drip file ilk repository", func() {
|
||||
modelWithDifferentLogIdx := test_data.DripFileIlkModel
|
||||
modelWithDifferentLogIdx.LogIndex++
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "drip_file_ilk_checked",
|
||||
CheckedHeaderColumnName: constants.DripFileIlkChecked,
|
||||
LogEventTableName: "maker.drip_file_ilk",
|
||||
TestModel: test_data.DripFileIlkModel,
|
||||
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
|
||||
@ -75,7 +76,7 @@ var _ = Describe("Drip file ilk repository", func() {
|
||||
|
||||
Describe("MarkHeaderChecked", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "drip_file_ilk_checked",
|
||||
CheckedHeaderColumnName: constants.DripFileIlkChecked,
|
||||
Repository: &dripFileIlkRepository,
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type DripFileRepoRepository struct {
|
||||
@ -49,11 +51,7 @@ func (repository DripFileRepoRepository) Create(headerID int64, models []interfa
|
||||
}
|
||||
}
|
||||
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, drip_file_repo_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET drip_file_repo_checked = $2`, headerID, true)
|
||||
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.DripFileRepoChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -63,28 +61,11 @@ func (repository DripFileRepoRepository) Create(headerID int64, models []interfa
|
||||
}
|
||||
|
||||
func (repository DripFileRepoRepository) MarkHeaderChecked(headerID int64) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO public.checked_headers (header_id, drip_file_repo_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET drip_file_repo_checked = $2`, headerID, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerID, repository.db, constants.DripFileRepoChecked)
|
||||
}
|
||||
|
||||
func (repository DripFileRepoRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
err := repository.db.Select(
|
||||
&result,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR drip_file_repo_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
repository.db.Node.ID,
|
||||
)
|
||||
return result, err
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DripFileRepoChecked)
|
||||
}
|
||||
|
||||
func (repository *DripFileRepoRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/repo"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
@ -47,7 +48,7 @@ var _ = Describe("Drip file repo repository", func() {
|
||||
modelWithDifferentLogIdx := test_data.DripFileRepoModel
|
||||
modelWithDifferentLogIdx.LogIndex++
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "drip_file_repo_checked",
|
||||
CheckedHeaderColumnName: constants.DripFileRepoChecked,
|
||||
LogEventTableName: "maker.drip_file_repo",
|
||||
TestModel: test_data.DripFileRepoModel,
|
||||
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
|
||||
@ -75,7 +76,7 @@ var _ = Describe("Drip file repo repository", func() {
|
||||
|
||||
Describe("MarkHeaderChecked", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "drip_file_repo_checked",
|
||||
CheckedHeaderColumnName: constants.DripFileRepoChecked,
|
||||
Repository: &dripFileRepoRepository,
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type DripFileVowRepository struct {
|
||||
@ -48,11 +50,7 @@ func (repository DripFileVowRepository) Create(headerID int64, models []interfac
|
||||
}
|
||||
}
|
||||
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, drip_file_vow_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET drip_file_vow_checked = $2`, headerID, true)
|
||||
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.DripFileVowChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -62,28 +60,11 @@ func (repository DripFileVowRepository) Create(headerID int64, models []interfac
|
||||
}
|
||||
|
||||
func (repository DripFileVowRepository) MarkHeaderChecked(headerID int64) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO public.checked_headers (header_id, drip_file_vow_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET drip_file_vow_checked = $2`, headerID, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerID, repository.db, constants.DripFileVowChecked)
|
||||
}
|
||||
|
||||
func (repository DripFileVowRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
err := repository.db.Select(
|
||||
&result,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR drip_file_vow_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
repository.db.Node.ID,
|
||||
)
|
||||
return result, err
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DripFileVowChecked)
|
||||
}
|
||||
|
||||
func (repository *DripFileVowRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/vow"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
@ -46,7 +47,7 @@ var _ = Describe("Drip file vow repository", func() {
|
||||
modelWithDifferentLogIdx := test_data.DripFileVowModel
|
||||
modelWithDifferentLogIdx.LogIndex++
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "drip_file_vow_checked",
|
||||
CheckedHeaderColumnName: constants.DripFileVowChecked,
|
||||
LogEventTableName: "maker.drip_file_vow",
|
||||
TestModel: test_data.DripFileVowModel,
|
||||
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
|
||||
@ -83,7 +84,7 @@ var _ = Describe("Drip file vow repository", func() {
|
||||
|
||||
Describe("MissingHeaders", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "drip_file_vow_checked",
|
||||
CheckedHeaderColumnName: constants.DripFileVowChecked,
|
||||
Repository: &dripFileVowRepository,
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type FlapKickRepository struct {
|
||||
@ -44,10 +46,8 @@ func (repository *FlapKickRepository) Create(headerID int64, models []interface{
|
||||
return err
|
||||
}
|
||||
}
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, flap_kick_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET flap_kick_checked = $2`, headerID, true)
|
||||
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.FlapKickChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -56,34 +56,11 @@ func (repository *FlapKickRepository) Create(headerID int64, models []interface{
|
||||
}
|
||||
|
||||
func (repository *FlapKickRepository) MarkHeaderChecked(headerID int64) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO public.checked_headers (header_id, flap_kick_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET flap_kick_checked = $2`, headerID, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerID, repository.db, constants.FlapKickChecked)
|
||||
}
|
||||
|
||||
func (repository FlapKickRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
err := repository.db.Select(
|
||||
&result,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR flap_kick_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
repository.db.Node.ID,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("Error:", err)
|
||||
return result, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.FlapKickChecked)
|
||||
}
|
||||
|
||||
func (repository *FlapKickRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/flap_kick"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
@ -46,7 +47,7 @@ var _ = Describe("Flap Kick Repository", func() {
|
||||
modelWithDifferentLogIdx := test_data.FlapKickModel
|
||||
modelWithDifferentLogIdx.LogIndex = modelWithDifferentLogIdx.LogIndex + 1
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "flap_kick_checked",
|
||||
CheckedHeaderColumnName: constants.FlapKickChecked,
|
||||
LogEventTableName: "maker.flap_kick",
|
||||
TestModel: test_data.FlapKickModel,
|
||||
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
|
||||
@ -80,7 +81,7 @@ var _ = Describe("Flap Kick Repository", func() {
|
||||
|
||||
Describe("MarkHeaderChecked", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "flap_kick_checked",
|
||||
CheckedHeaderColumnName: constants.FlapKickChecked,
|
||||
Repository: &flapKickRepository,
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type PitFileDebtCeilingRepository struct {
|
||||
@ -49,11 +51,7 @@ func (repository PitFileDebtCeilingRepository) Create(headerID int64, models []i
|
||||
}
|
||||
}
|
||||
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, pit_file_debt_ceiling_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET pit_file_debt_ceiling_checked = $2`, headerID, true)
|
||||
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.PitFileDebtCeilingChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -63,28 +61,11 @@ func (repository PitFileDebtCeilingRepository) Create(headerID int64, models []i
|
||||
}
|
||||
|
||||
func (repository PitFileDebtCeilingRepository) MarkHeaderChecked(headerID int64) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO public.checked_headers (header_id, pit_file_debt_ceiling_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET pit_file_debt_ceiling_checked = $2`, headerID, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerID, repository.db, constants.PitFileDebtCeilingChecked)
|
||||
}
|
||||
|
||||
func (repository PitFileDebtCeilingRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
err := repository.db.Select(
|
||||
&result,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR pit_file_debt_ceiling_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
repository.db.Node.ID,
|
||||
)
|
||||
return result, err
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.PitFileDebtCeilingChecked)
|
||||
}
|
||||
|
||||
func (repository *PitFileDebtCeilingRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/debt_ceiling"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
@ -46,7 +47,7 @@ var _ = Describe("Pit file debt ceiling repository", func() {
|
||||
modelWithDifferentLogIdx := test_data.PitFileDebtCeilingModel
|
||||
modelWithDifferentLogIdx.LogIndex = modelWithDifferentLogIdx.LogIndex + 1
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "pit_file_debt_ceiling_checked",
|
||||
CheckedHeaderColumnName: constants.PitFileDebtCeilingChecked,
|
||||
LogEventTableName: "maker.pit_file_debt_ceiling",
|
||||
TestModel: test_data.PitFileDebtCeilingModel,
|
||||
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
|
||||
@ -74,7 +75,7 @@ var _ = Describe("Pit file debt ceiling repository", func() {
|
||||
|
||||
Describe("MarkHeaderChecked", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "pit_file_debt_ceiling_checked",
|
||||
CheckedHeaderColumnName: constants.PitFileDebtCeilingChecked,
|
||||
Repository: &pitFileDebtCeilingRepository,
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type PitFileIlkRepository struct {
|
||||
@ -47,10 +49,8 @@ func (repository PitFileIlkRepository) Create(headerID int64, models []interface
|
||||
return err
|
||||
}
|
||||
}
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, pit_file_ilk_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET pit_file_ilk_checked = $2`, headerID, true)
|
||||
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.PitFileIlkChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -59,28 +59,11 @@ func (repository PitFileIlkRepository) Create(headerID int64, models []interface
|
||||
}
|
||||
|
||||
func (repository PitFileIlkRepository) MarkHeaderChecked(headerID int64) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO public.checked_headers (header_id, pit_file_ilk_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET pit_file_ilk_checked = $2`, headerID, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerID, repository.db, constants.PitFileIlkChecked)
|
||||
}
|
||||
|
||||
func (repository PitFileIlkRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
err := repository.db.Select(
|
||||
&result,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR pit_file_ilk_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
repository.db.Node.ID,
|
||||
)
|
||||
return result, err
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.PitFileIlkChecked)
|
||||
}
|
||||
|
||||
func (repository *PitFileIlkRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/ilk"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
@ -46,7 +47,7 @@ var _ = Describe("Pit file ilk repository", func() {
|
||||
modelWithDifferentLogIdx := test_data.PitFileIlkModel
|
||||
modelWithDifferentLogIdx.LogIndex = modelWithDifferentLogIdx.LogIndex + 1
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "pit_file_ilk_checked",
|
||||
CheckedHeaderColumnName: constants.PitFileIlkChecked,
|
||||
LogEventTableName: "maker.pit_file_ilk",
|
||||
TestModel: test_data.PitFileIlkModel,
|
||||
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
|
||||
@ -75,7 +76,7 @@ var _ = Describe("Pit file ilk repository", func() {
|
||||
|
||||
Describe("MarkHeaderChecked", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "pit_file_ilk_checked",
|
||||
CheckedHeaderColumnName: constants.PitFileIlkChecked,
|
||||
Repository: &pitFileIlkRepository,
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type PitFileStabilityFeeRepository struct {
|
||||
@ -49,11 +51,7 @@ func (repository PitFileStabilityFeeRepository) Create(headerID int64, models []
|
||||
}
|
||||
}
|
||||
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, pit_file_stability_fee_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET pit_file_stability_fee_checked = $2`, headerID, true)
|
||||
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.PitFileStabilityFeeChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -63,28 +61,11 @@ func (repository PitFileStabilityFeeRepository) Create(headerID int64, models []
|
||||
}
|
||||
|
||||
func (repository PitFileStabilityFeeRepository) MarkHeaderChecked(headerID int64) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO public.checked_headers (header_id, pit_file_stability_fee_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET pit_file_stability_fee_checked = $2`, headerID, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerID, repository.db, constants.PitFileStabilityFeeChecked)
|
||||
}
|
||||
|
||||
func (repository PitFileStabilityFeeRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
err := repository.db.Select(
|
||||
&result,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR pit_file_stability_fee_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
repository.db.Node.ID,
|
||||
)
|
||||
return result, err
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.PitFileStabilityFeeChecked)
|
||||
}
|
||||
|
||||
func (repository *PitFileStabilityFeeRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/stability_fee"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
@ -46,7 +47,7 @@ var _ = Describe("Pit file stability fee repository", func() {
|
||||
modelWithDifferentLogIdx := test_data.PitFileStabilityFeeModel
|
||||
modelWithDifferentLogIdx.LogIndex = modelWithDifferentLogIdx.LogIndex + 1
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "pit_file_stability_fee_checked",
|
||||
CheckedHeaderColumnName: constants.PitFileStabilityFeeChecked,
|
||||
LogEventTableName: "maker.pit_file_stability_fee",
|
||||
TestModel: test_data.PitFileStabilityFeeModel,
|
||||
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
|
||||
@ -74,7 +75,7 @@ var _ = Describe("Pit file stability fee repository", func() {
|
||||
|
||||
Describe("MarkHeaderChecked", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "pit_file_stability_fee_checked",
|
||||
CheckedHeaderColumnName: constants.PitFileStabilityFeeChecked,
|
||||
Repository: &pitFileStabilityFeeRepository,
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type PriceFeedRepository struct {
|
||||
@ -43,10 +45,8 @@ func (repository PriceFeedRepository) Create(headerID int64, models []interface{
|
||||
return err
|
||||
}
|
||||
}
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, price_feeds_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET price_feeds_checked = $2`, headerID, true)
|
||||
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.PriceFeedsChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -55,28 +55,11 @@ func (repository PriceFeedRepository) Create(headerID int64, models []interface{
|
||||
}
|
||||
|
||||
func (repository PriceFeedRepository) MarkHeaderChecked(headerID int64) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO public.checked_headers (header_id, price_feeds_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET price_feeds_checked = $2`, headerID, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerID, repository.db, constants.PriceFeedsChecked)
|
||||
}
|
||||
|
||||
func (repository PriceFeedRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
err := repository.db.Select(
|
||||
&result,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR price_feeds_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
repository.db.Node.ID,
|
||||
)
|
||||
return result, err
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.PriceFeedsChecked)
|
||||
}
|
||||
|
||||
func (repository *PriceFeedRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/price_feeds"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
@ -46,7 +47,7 @@ var _ = Describe("Price feeds repository", func() {
|
||||
modelWithDifferentLogIdx := test_data.PriceFeedModel
|
||||
modelWithDifferentLogIdx.LogIndex = modelWithDifferentLogIdx.LogIndex + 1
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "price_feeds_checked",
|
||||
CheckedHeaderColumnName: constants.PriceFeedsChecked,
|
||||
LogEventTableName: "maker.price_feeds",
|
||||
TestModel: test_data.PriceFeedModel,
|
||||
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
|
||||
@ -75,7 +76,7 @@ var _ = Describe("Price feeds repository", func() {
|
||||
|
||||
Describe("MarkHeaderChecked", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "price_feeds_checked",
|
||||
CheckedHeaderColumnName: constants.PriceFeedsChecked,
|
||||
Repository: &priceFeedRepository,
|
||||
}
|
||||
|
||||
|
19
pkg/transformers/shared/constants/checked_headers.go
Normal file
19
pkg/transformers/shared/constants/checked_headers.go
Normal file
@ -0,0 +1,19 @@
|
||||
package constants
|
||||
|
||||
var (
|
||||
CatFileChopLumpChecked = "cat_file_chop_lump_checked"
|
||||
CatFileFlipChecked = "cat_file_flip_checked"
|
||||
CatFilePitVowChecked = "cat_file_pit_vow_checked"
|
||||
DealChecked = "deal_checked"
|
||||
DentChecked = "dent_checked"
|
||||
DripDripChecked = "drip_drip_checked"
|
||||
DripFileIlkChecked = "drip_file_ilk_checked"
|
||||
DripFileRepoChecked = "drip_file_repo_checked"
|
||||
DripFileVowChecked = "drip_file_vow_checked"
|
||||
FlapKickChecked = "flap_kick_checked"
|
||||
PitFileDebtCeilingChecked = "pit_file_debt_ceiling_checked"
|
||||
PitFileIlkChecked = "pit_file_ilk_checked"
|
||||
PitFileStabilityFeeChecked = "pit_file_stability_fee_checked"
|
||||
PriceFeedsChecked = "price_feeds_checked"
|
||||
TendChecked = "tend_checked"
|
||||
)
|
40
pkg/transformers/shared/repository.go
Normal file
40
pkg/transformers/shared/repository.go
Normal file
@ -0,0 +1,40 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
)
|
||||
|
||||
func MarkHeaderChecked(headerID int64, db *postgres.DB, checkedHeadersColumn string) error {
|
||||
_, err := db.Exec(`INSERT INTO public.checked_headers (header_id, `+checkedHeadersColumn+`)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET `+checkedHeadersColumn+` = $2`, headerID, true)
|
||||
return err
|
||||
}
|
||||
|
||||
func MarkHeaderCheckedInTransaction(headerID int64, tx *sql.Tx, checkedHeadersColumn string) error {
|
||||
_, err := tx.Exec(`INSERT INTO public.checked_headers (header_id, `+checkedHeadersColumn+`)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET `+checkedHeadersColumn+` = $2`, headerID, true)
|
||||
return err
|
||||
}
|
||||
|
||||
func MissingHeaders(startingBlockNumber, endingBlockNumber int64, db *postgres.DB, checkedHeadersColumn string) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
err := db.Select(
|
||||
&result,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR `+checkedHeadersColumn+` IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
db.Node.ID,
|
||||
)
|
||||
return result, err
|
||||
}
|
@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type TendRepository struct {
|
||||
@ -48,11 +50,8 @@ func (repository TendRepository) Create(headerId int64, models []interface{}) er
|
||||
return err
|
||||
}
|
||||
}
|
||||
_, err = tx.Exec(`INSERT INTO public.checked_headers (header_id, tend_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET tend_checked = $2`, headerId, true)
|
||||
|
||||
err = shared.MarkHeaderCheckedInTransaction(headerId, tx, constants.TendChecked)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@ -61,29 +60,11 @@ func (repository TendRepository) Create(headerId int64, models []interface{}) er
|
||||
}
|
||||
|
||||
func (repository TendRepository) MarkHeaderChecked(headerId int64) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO public.checked_headers (header_id, tend_checked)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (header_id) DO
|
||||
UPDATE SET tend_checked = $2`, headerId, true)
|
||||
return err
|
||||
return shared.MarkHeaderChecked(headerId, repository.db, constants.TendChecked)
|
||||
}
|
||||
|
||||
func (repository TendRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
err := repository.db.Select(
|
||||
&result,
|
||||
`SELECT headers.id, headers.block_number FROM headers
|
||||
LEFT JOIN checked_headers on headers.id = header_id
|
||||
WHERE (header_id ISNULL OR tend_checked IS FALSE)
|
||||
AND headers.block_number >= $1
|
||||
AND headers.block_number <= $2
|
||||
AND headers.eth_node_fingerprint = $3`,
|
||||
startingBlockNumber,
|
||||
endingBlockNumber,
|
||||
repository.db.Node.ID,
|
||||
)
|
||||
|
||||
return result, err
|
||||
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.TendChecked)
|
||||
}
|
||||
|
||||
func (repository *TendRepository) SetDB(db *postgres.DB) {
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/tend"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
|
||||
@ -46,7 +47,7 @@ var _ = Describe("TendRepository", func() {
|
||||
modelWithDifferentLogIdx := test_data.TendModel
|
||||
modelWithDifferentLogIdx.LogIndex = modelWithDifferentLogIdx.LogIndex + 1
|
||||
inputs := shared_behaviors.CreateBehaviorInputs{
|
||||
CheckedHeaderColumnName: "tend_checked",
|
||||
CheckedHeaderColumnName: constants.TendChecked,
|
||||
LogEventTableName: "maker.tend",
|
||||
TestModel: test_data.TendModel,
|
||||
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
|
||||
@ -84,7 +85,7 @@ var _ = Describe("TendRepository", func() {
|
||||
|
||||
Describe("MarkHeaderChecked", func() {
|
||||
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
|
||||
CheckedHeaderColumnName: "tend_checked",
|
||||
CheckedHeaderColumnName: constants.TendChecked,
|
||||
Repository: &tendRepository,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user