Skip to content
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

Make IterFields take in aliases #3207

Merged
merged 23 commits into from
Feb 13, 2024
Merged

Make IterFields take in aliases #3207

merged 23 commits into from
Feb 13, 2024

Conversation

edwardfeng-db
Copy link
Contributor

@edwardfeng-db edwardfeng-db commented Feb 2, 2024

Changes

  • Make aliases information from ResourceProviderStruct take effect in iterFields function so that StructToData and DataToStructPointer will take information about the aliases
  • Taking out UnderlyingType method because it is no longer needed
  • Adding an anonymous field for the ClusterResourceProvider struct so that reflection will work without UnderlyingType
  • Make iterField check alias information
  • Adding unit test case

Tests

  • make test run locally
  • relevant change in docs/ folder
  • covered with integration tests in internal/acceptance
  • relevant acceptance tests are passing
  • using Go SDK

@codecov-commenter
Copy link

codecov-commenter commented Feb 2, 2024

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (d3acc7b) 83.57% compared to head (c8c2bdc) 83.85%.
Report is 24 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3207      +/-   ##
==========================================
+ Coverage   83.57%   83.85%   +0.28%     
==========================================
  Files         168      170       +2     
  Lines       15021    15315     +294     
==========================================
+ Hits        12554    12843     +289     
+ Misses       1729     1721       -8     
- Partials      738      751      +13     
Files Coverage Δ
clusters/resource_cluster.go 87.82% <100.00%> (-0.05%) ⬇️
common/reflect_resource.go 84.60% <88.63%> (+1.66%) ⬆️

... and 20 files with indirect coverage changes

@edwardfeng-db edwardfeng-db marked this pull request as ready for review February 5, 2024 08:54
@edwardfeng-db edwardfeng-db requested review from a team as code owners February 5, 2024 08:54
@edwardfeng-db edwardfeng-db requested review from hectorcast-db and mgyucht and removed request for a team February 5, 2024 08:54
Copy link
Contributor

@mgyucht mgyucht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making good progress. Let's see if there is a way we can continue to use StructToSchema as the main entrypoint so that developers can easily switch to using this custom implementation without having to rewrite their calls to StructToSchema. This makes library code like WorkspaceData/AccountData more portable to the new model (and would immediately solve problems like #3211 is trying to solve)

common/reflect_resource.go Outdated Show resolved Hide resolved
common/reflect_resource.go Outdated Show resolved Hide resolved
common/reflect_resource.go Outdated Show resolved Hide resolved
common/reflect_resource.go Show resolved Hide resolved
common/reflect_resource.go Outdated Show resolved Hide resolved
common/reflect_resource.go Outdated Show resolved Hide resolved
common/reflect_resource_test.go Show resolved Hide resolved
common/reflect_resource_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@mgyucht mgyucht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple more comments.


func (ClusterResourceProvider) UnderlyingType() compute.ClusterSpec {
return compute.ClusterSpec{}
type ClusterResourceProvider struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just call this Cluster, in the same way that we have SqlEndpoint.

Copy link
Contributor Author

@edwardfeng-db edwardfeng-db Feb 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Cluster is already defined, so how about naming it ClusterSpec?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either is better than ClusterResourceProvider :)

common/reflect_resource.go Outdated Show resolved Hide resolved
common/reflect_resource.go Outdated Show resolved Hide resolved
common/reflect_resource_test.go Outdated Show resolved Hide resolved
common/reflect_resource.go Show resolved Hide resolved
Copy link
Contributor

@mgyucht mgyucht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

common/reflect_resource.go Outdated Show resolved Hide resolved
@mgyucht mgyucht added this pull request to the merge queue Feb 13, 2024
Merged via the queue into main with commit 500ed84 Feb 13, 2024
5 checks passed
@mgyucht mgyucht deleted the edwardfeng-db/iter-field-alias branch February 13, 2024 00:14
@tanmay-db tanmay-db mentioned this pull request Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants