-
Notifications
You must be signed in to change notification settings - Fork 543
Added new output binding for Cosmos Graph DB - Gremlin #885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@beiwei30 can you please review? |
|
@beiwei30 I fixed the issue causing the golangci-lint to fail. |
halspang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple sections of commented code, let's remove it if we don't need it or put it back if we do.
| // NumMaxActiveConnections string `json:"NumMaxActiveConnections"` | ||
| // ConnectionIdleTimeout string `json:"ConnectionIdleTimeout"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we not want to use these and give defaults if they aren't provided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, @halspang you are right , some comments need to be removed along with these values (NumMaxActiveConnections, ConnectionIdleTimeout) , I felt like it is over complicating the component YAML file , so I decided to remove it . any way the gremcos package assign there values to a default values which is more than enough for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All unwanted comment removed.
|
@hokandil please resolve the conflicts and we'll assign a reviewer. |
|
@yaron2 Done, conflicts resolved , thank you |
|
@halspang can you please review this? |
halspang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me, just some small last things.
@yaron2 is passing the query though metadata the standard? If so, what's the reasoning behind it? I'm fine with it if that's the case, just curious.
|
@hokandil I left two comments. kindly fix those, and resolve the linter issue: Then we can merge :) |
|
@hokandil ping |
|
@yaron2 I am on testing phase, I will commit shortly , maybe tomorrow . |
|
@yaron2 Done |
pkedy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pointing out a few potential improvements.
| } | ||
|
|
||
| func (c *CosmosGraphDB) parseMetadata(metadata bindings.Metadata) (*cosmosGraphDBCredentials, error) { | ||
| b, err := json.Marshal(metadata.Properties) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: You can use the configuration decoding pattern we have instead of Marshaling/Unmarshaling JSON.
Example:
https://github.com/dapr/components-contrib/blob/master/bindings/alicloud/nacos/nacos.go#L59-L66
https://github.com/dapr/components-contrib/blob/master/bindings/alicloud/nacos/settings.go
| return nil, errors.New("CosmosGraphDB Error: Cannot convert request data") | ||
| } | ||
|
|
||
| gq := fmt.Sprintf("%s", jsonPoint[commandGremlinKey]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: It might more sense to unmarshal into an inline struct instead of map[string]interface{} since you know the field you expect.
type gremlinData struct {
Gremlin string `json:"gremlin"` // Note sure if this is always a string, use `interface{}` otherwise.
}
var jsonPoint gremlinDataAlso, using %v might make more since for an interface{} going in. But again, if the value is always going to be a string then the fmt.Sprintf is unnecessary.
gq := fmt.Sprintf("%v", jsonPoint[commandGremlinKey])
Codecov Report
@@ Coverage Diff @@
## master #885 +/- ##
==========================================
+ Coverage 30.59% 34.21% +3.61%
==========================================
Files 85 133 +48
Lines 7148 10595 +3447
==========================================
+ Hits 2187 3625 +1438
- Misses 4724 6591 +1867
- Partials 237 379 +142
Continue to review full report at Codecov.
|
* master: (23 commits) Adds support for TTL in Redis State Store (dapr#990) Adds support for TTL in Memcached State Store (PR Fixup) (dapr#1011) Adds support for TTL in Cassandra State Store (dapr#996) Return blob metadata and add list operation (dapr#999) Added new output binding for Cosmos Graph DB - Gremlin (dapr#885) Adds support for TTL in CosmosDB State Store (dapr#991) Delete unused code and update test (dapr#924) Return SystemProperties on events from EventHubs bindings and pubsub (dapr#1009) Implement E2E tests for zeebe (dapr#973) rebase (dapr#982) Update CODEOWNERS (dapr#987) ci: add test skip case (dapr#922) fix: Mysql should support more data types. dapr#923 (dapr#926) fix: Dapr runtime panic when handle Pub/Sub (dapr#3281) (dapr#967) switch to golang-jwt (dapr#993) unmarshal getBlobRetryCount as int (dapr#919) secretstores: support more format of azure key vault (dapr#944) Optimize vault secret component error output (dapr#909) Convert AZURE_KEYVAULT in conformance.yml a GitHub secret (dapr#1002) Use AzureKeyVaultName param for Azure Keyvault conformance test (dapr#975) ... # Conflicts: # secretstores/hashicorp/vault/vault.go
Description
I added a new output binding to support graph DB in Azure Cosmos via the Gremlin API.
unfortunately there no issue reference for this PR , although I found it useful to share this with you.
Please make sure you've completed the relevant tasks for this PR, out of the following list: