Skip to content

Commit

Permalink
v1 golang example change
Browse files Browse the repository at this point in the history
  • Loading branch information
Satvik Patil authored and Satvik Patil committed Jan 2, 2025
1 parent 42c6db6 commit 282ca32
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions examples/connector/golang/golang_connector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
pb "fivetran.com/fivetran_sdk/proto"
"google.golang.org/grpc"
_ "google.golang.org/grpc/encoding/gzip"

)

const INFO = "INFO"
Expand All @@ -36,7 +35,7 @@ func (s *server) Update(in *pb.UpdateRequest, stream pb.Connector_UpdateServer)
state := MyState{}
json.Unmarshal([]byte(state_json), &state)

message := fmt.Sprintf("config: %s, selection: %s, state_json: %s, mystate: %s", config, selection, state_json, state)
message := fmt.Sprintf("config: %s, selection: %s, state_json: %s, mystate: %+v", config, selection, state_json, state)
LogMessage(INFO, message)

// -- Send a log message
Expand Down Expand Up @@ -146,7 +145,7 @@ func (s *server) Update(in *pb.UpdateRequest, stream pb.Connector_UpdateServer)
},
})

LogMessage(SEVERE, "Sample severe message: Update call completed")
LogMessage(SEVERE, "Sample severe message: Update call completed")
// End the RPC call
return nil
}
Expand Down Expand Up @@ -226,10 +225,10 @@ func (s *server) ConfigurationForm(ctx context.Context, in *pb.ConfigurationForm
},
},
{
Name: "isPublic",
Label: "Public?",
Name: "isPublic",
Label: "Public?",
Description: &toggleDescription,
Required: false,
Required: false,
Type: &pb.FormField_ToggleField{
ToggleField: &pb.ToggleField{},
},
Expand Down Expand Up @@ -273,13 +272,13 @@ func (s *server) Test(ctx context.Context, in *pb.TestRequest) (*pb.TestResponse
}

func LogMessage(level string, message string) {
log := map[string]interface{}{
"level": level,
"message": message,
"message-origin": "sdk_connector",
}
logJSON, _ := json.Marshal(log)
fmt.Println(string(logJSON))
log := map[string]interface{}{
"level": level,
"message": message,
"message-origin": "sdk_connector",
}
logJSON, _ := json.Marshal(log)
fmt.Println(string(logJSON))
}

func main() {
Expand Down

0 comments on commit 282ca32

Please sign in to comment.