Skip to content

Commit

Permalink
feat: add token_list param in ClickhouseDump
Browse files Browse the repository at this point in the history
  • Loading branch information
ranjanrak committed Aug 26, 2021
1 parent 9064c9f commit a685163
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import (
)
// Dump tick websocket data to clickhouse
clickhousegraphqlgo.ClickhouseDump()
// Pass list of instrument token for subscription to websocket feeds
clickhousegraphqlgo.ClickhouseDump([]uint32{779521, 256265, 1893123, 13209858})
// Run graphql server on clickhouse
clickhousegraphqlgo.GraphqlServer()
Expand Down
10 changes: 5 additions & 5 deletions clickhouse_dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import (
)

var (
connect *sql.DB
err error
connect *sql.DB
err error
token_list []uint32
)

var token_list = []uint32{58375943, 58731527, 1893123, 57489927}

func SetDB() {

// Use DSN as your clickhouse DB setup.
Expand Down Expand Up @@ -118,9 +117,10 @@ func onNoReconnect(attempt int) {
fmt.Printf("Maximum no of reconnect attempt reached: %d", attempt)
}

func ClickhouseDump() {
func ClickhouseDump(tokens []uint32) {
apiKey := "your_api_key"
accessToken := "your_access_token"
token_list = tokens

// Perform DB related part
SetDB()
Expand Down

0 comments on commit a685163

Please sign in to comment.