k-capehart / go-salesforce

Salesforce REST API client written in Go
https://pkg.go.dev/github.com/k-capehart/go-salesforce/v2
MIT License
24 stars 4 forks source link

Return `SalesforceResult` when inserting data #45

Closed 0cv closed 3 weeks ago

0cv commented 1 month ago

Address https://github.com/k-capehart/go-salesforce/issues/42

@k-capehart I know we discussed I'd not work on it, but I like this Go Sfdc module the most and well .. well I just built quickly what I needed. I'm not sure it's "production" ready so I put just a draft. So to explain a bit what I did, I've mostly reused the already existing salesforceError which I renamed to SalesforceResult. And instead of formatting the error, which I don't think is a good idea, I'm returning this struct to the client. Then that's the client which can iterate through the result and analyze the errors accordingly (and get the created Sfdc ID). I've also plugged it into InsertOne. Again it fits my needs, but it might need some polishing so for now I think it's more like an implementation idea.

k-capehart commented 1 month ago

@0cv Thanks for drafting this! 🏆

I really like these suggestions, I think its a much needed improvement. What I'll end up doing is pull these changes into another branch and do some testing + any updates that might be needed. Once that's done, I'll ping you for another review. And then since this would technically be a breaking change I'll roll it out as version 2.0.0 🚀