MCPcopy Index your code
hub / github.com/cloudquery/cloudquery / hintSelectMessage

Function hintSelectMessage

cli/cmd/sync_v3.go:740–811  ·  view source on GitHub ↗
(destinationSpecs []specs.Destination, statsPerTable *utils.ConcurrentMap[string, SyncRunTableProgressValue], sourceTables map[string]bool)

Source from the content-addressed store, hash-verified

738}
739
740func hintSelectMessage(destinationSpecs []specs.Destination, statsPerTable *utils.ConcurrentMap[string, SyncRunTableProgressValue], sourceTables map[string]bool) {
741 val, _ := config.GetValue("first_sync_completed")
742 firstSyncCompleted, _ := strconv.ParseBool(val)
743 if firstSyncCompleted {
744 return
745 }
746
747 if auth.NewTokenClient().GetTokenType() != auth.BearerToken {
748 return
749 }
750
751 ensureDependencies := func(tableQuery tableQueries) bool {
752 for _, dependency := range tableQuery.Dependencies {
753 _, ok := sourceTables[dependency]
754 if !ok {
755 return false
756 }
757 }
758 return true
759 }
760
761 destPaths := lo.SliceToMap(destinationSpecs, func(spec specs.Destination) (string, specs.Destination) {
762 return spec.Path, spec
763 })
764
765 for _, tablePair := range tablesQueries {
766 tables := lo.Keys(tablePair)
767 if len(tables) == 0 {
768 continue
769 }
770 tableName := tables[0]
771 rows, ok := statsPerTable.Get(tableName)
772 if !ok || rows.Rows == 0 {
773 continue
774 }
775
776 tableQuery := tablePair[tableName]
777
778 if !ensureDependencies(tableQuery) {
779 continue
780 }
781
782 for _, destinationQuery := range tableQuery.Destinations {
783 destinationPaths := lo.Keys(destinationQuery)
784 if len(destinationPaths) == 0 {
785 continue
786 }
787 destinationPath := destinationPaths[0]
788 destSpec, ok := destPaths[destinationPath]
789 if !ok {
790 continue
791 }
792
793 fmt.Println()
794 fmt.Println("🎉 Success!")
795 fmt.Println()
796 fmt.Println(tableQuery.Description)
797 fmt.Println()

Callers 1

syncConnectionV3Function · 0.85

Calls 3

PrintlnMethod · 0.80
PrintfMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected