Skip to content

feat: Resolve proto timestamp to schema.TypeTimestamp#135

Closed
candiduslynx wants to merge 2 commits intomainfrom
feat/proto-timestamp
Closed

feat: Resolve proto timestamp to schema.TypeTimestamp#135
candiduslynx wants to merge 2 commits intomainfrom
feat/proto-timestamp

Conversation

@candiduslynx
Copy link
Copy Markdown
Contributor

@candiduslynx candiduslynx commented Sep 19, 2022

Summary


Use the following steps to ensure your PR is ready to be reviewed

  • Read the contribution guidelines 🧑‍🎓
  • Run go fmt to format your code 🖊
  • Lint your changes via golangci-lint run 🚨 (install golangci-lint here)
  • Update or add tests 🧪
  • Ensure the status checks below are successful ✅

@github-actions github-actions bot added feat and removed feat labels Sep 19, 2022
@candiduslynx candiduslynx enabled auto-merge (squash) September 19, 2022 13:48
@github-actions github-actions bot added feat and removed feat labels Sep 19, 2022
t := v.PkgPath() + "." + v.Name()
if t == "time.Time" {
switch t := v.PkgPath() + "." + v.Name(); t {
case "time.Time", "google.golang.org/protobuf/types/known/timestamppb.Timestamp":
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure we want the SDK to be aware of specific non built-in Go types

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with @erezrokah . Here it's not so bad but in column.go it makes an import which will cause all plugins to import unrelated libraries and grow in size which we should be careful with.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, at the very least we can do a custom mapping for the type, but we need a custom mapper for the value as well (timestamppb.Timestamp -> time.Time)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about check for an interface? here it's documented that there's an AsTime() time.Time method... Maybe define that as timestamppb's signature and use it?

auto-merge was automatically disabled September 20, 2022 13:51

Pull request was closed

@candiduslynx candiduslynx deleted the feat/proto-timestamp branch September 20, 2022 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants