refactor: move filter and fetch to pkg

This commit is contained in:
Mohamed Sohail 2023-01-14 09:20:16 +00:00
parent f791b87172
commit 02e31146cc
Signed by: kamikazechaser
GPG Key ID: 7DD45520C01CD85D
14 changed files with 12 additions and 14 deletions

View File

@ -1 +0,0 @@
export TEST_GRAPHQL_ENDPOINT=

View File

@ -13,6 +13,5 @@ mod:
go mod tidy go mod tidy
go mod verify go mod verify
test: test-pkg:
source .env.test TEST_GRAPHQL_ENDPOINT=https://rpc.alfajores.celo.grassecon.net/graphql go test -v -covermode atomic -coverprofile=covprofile ./pkg/...
go test -v -covermode atomic -coverprofile=covprofile ./internal/...

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"github.com/grassrootseconomics/cic-chain-events/internal/filter" "github.com/grassrootseconomics/cic-chain-events/pkg/filter"
) )
func initAddressFilter() filter.Filter { func initAddressFilter() filter.Filter {

View File

@ -5,9 +5,9 @@ import (
"strings" "strings"
"github.com/alitto/pond" "github.com/alitto/pond"
"github.com/grassrootseconomics/cic-chain-events/internal/fetch"
"github.com/grassrootseconomics/cic-chain-events/internal/pool" "github.com/grassrootseconomics/cic-chain-events/internal/pool"
"github.com/grassrootseconomics/cic-chain-events/internal/store" "github.com/grassrootseconomics/cic-chain-events/internal/store"
"github.com/grassrootseconomics/cic-chain-events/pkg/fetch"
"github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5"
"github.com/knadh/goyesql/v2" "github.com/knadh/goyesql/v2"
"github.com/knadh/koanf" "github.com/knadh/koanf"

View File

@ -11,9 +11,9 @@ import (
"time" "time"
"github.com/grassrootseconomics/cic-chain-events/internal/api" "github.com/grassrootseconomics/cic-chain-events/internal/api"
"github.com/grassrootseconomics/cic-chain-events/internal/filter"
"github.com/grassrootseconomics/cic-chain-events/internal/pipeline" "github.com/grassrootseconomics/cic-chain-events/internal/pipeline"
"github.com/grassrootseconomics/cic-chain-events/internal/syncer" "github.com/grassrootseconomics/cic-chain-events/internal/syncer"
"github.com/grassrootseconomics/cic-chain-events/pkg/filter"
"github.com/knadh/goyesql/v2" "github.com/knadh/goyesql/v2"
"github.com/knadh/koanf" "github.com/knadh/koanf"
"github.com/zerodha/logf" "github.com/zerodha/logf"

View File

@ -3,9 +3,9 @@ package pipeline
import ( import (
"context" "context"
"github.com/grassrootseconomics/cic-chain-events/internal/fetch"
"github.com/grassrootseconomics/cic-chain-events/internal/filter"
"github.com/grassrootseconomics/cic-chain-events/internal/store" "github.com/grassrootseconomics/cic-chain-events/internal/store"
"github.com/grassrootseconomics/cic-chain-events/pkg/fetch"
"github.com/grassrootseconomics/cic-chain-events/pkg/filter"
"github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5"
"github.com/zerodha/logf" "github.com/zerodha/logf"
) )

View File

@ -5,7 +5,7 @@ import (
"sync" "sync"
celo "github.com/grassrootseconomics/cic-celo-sdk" celo "github.com/grassrootseconomics/cic-celo-sdk"
"github.com/grassrootseconomics/cic-chain-events/internal/fetch" "github.com/grassrootseconomics/cic-chain-events/pkg/fetch"
"github.com/zerodha/logf" "github.com/zerodha/logf"
) )

View File

@ -5,7 +5,7 @@ import (
"sync" "sync"
"testing" "testing"
"github.com/grassrootseconomics/cic-chain-events/internal/fetch" "github.com/grassrootseconomics/cic-chain-events/pkg/fetch"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/zerodha/logf" "github.com/zerodha/logf"
) )

View File

@ -5,7 +5,7 @@ import (
"math/big" "math/big"
"github.com/celo-org/celo-blockchain/common" "github.com/celo-org/celo-blockchain/common"
"github.com/grassrootseconomics/cic-chain-events/internal/fetch" "github.com/grassrootseconomics/cic-chain-events/pkg/fetch"
"github.com/grassrootseconomics/w3-celo-patch" "github.com/grassrootseconomics/w3-celo-patch"
"github.com/zerodha/logf" "github.com/zerodha/logf"
) )

View File

@ -4,7 +4,7 @@ import (
"context" "context"
"testing" "testing"
"github.com/grassrootseconomics/cic-chain-events/internal/fetch" "github.com/grassrootseconomics/cic-chain-events/pkg/fetch"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/zerodha/logf" "github.com/zerodha/logf"
) )

View File

@ -3,7 +3,7 @@ package filter
import ( import (
"context" "context"
"github.com/grassrootseconomics/cic-chain-events/internal/fetch" "github.com/grassrootseconomics/cic-chain-events/pkg/fetch"
) )
// Filter defines a read only filter which must return next as true/false or an error // Filter defines a read only filter which must return next as true/false or an error