Skip to content

Commit

Permalink
Fix casts
Browse files Browse the repository at this point in the history
  • Loading branch information
ekarlso committed Oct 10, 2024
1 parent 9918d1b commit e693ae4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions config/databases/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,19 @@ func addConnectionInfo(attr map[string]any) (map[string][]byte, error) {
for key, value := range endpoint {
endpointKey := fmt.Sprintf("endpoint_%d_%s", idx, key)

val := fmt.Sprintf("%s", value)
attr[endpointKey] = val
var val []byte
switch value.(type) {
case float64:
val = []byte(fmt.Sprintf("%.0f", value))
case bool:
val = []byte(fmt.Sprintf("%b", value))
case string:
val = []byte(fmt.Sprintf("%s", value))
default:
continue
}

fmt.Printf("Endpoint %s -> %s\n", endpointKey, val)
conn[endpointKey] = val
}
}
}
Expand Down

0 comments on commit e693ae4

Please sign in to comment.