petkostas commented on issue #8442: URL: https://github.com/apache/incubator-devlake/issues/8442#issuecomment-3193787361
Update 👇🏼 I have confirmed that nullable date fields in GraphQL are always returning a `0001-01-01` value due to the GO implementation. What this means is that even if we are using `*time.Time` actually translates to the following ```go type ChecRun struct { StartedAt *time.Time } func main() { instance := &ChecRun{} test_payload := []byte(`{"StartedAt": "0001-01-01"}`) _ = json.Unmarshal(test_payload, instance) anotherTest := &ChecRun{ StartedAt: instance.StartedAt, } fmt.Println("Is Nil:", instance.StartedAt == nil) fmt.Println("Is Nil:", anotherTest.StartedAt == nil) fmt.Println(instance) fmt.Println(anotherTest) } ``` Which produces: ```bash Is Nil: false Is Nil: false &{0001-01-01 00:00:00 +0000 UTC} &{0001-01-01 00:00:00 +0000 UTC} ``` According to tickets and resources I could find, GORM does not treat a pointer to zero time as a "missing value." Only a real nil pointer is considered NULL and stored as SQL NULL. Next to that there is another issue, the Apache Devlake GitHub models in their majority have a `*time.Time` field, which makes it easy to track which fields should be conditionally set to `nil` in the collectors and extractors (this is required for existing data in the DB as the extractor will crash). The only drawback / time consuming case here is that I have identified at least one GitHub model which has a non nullable datetime (releases) while the documentation of the GraphQL API states the opposite ```go type GithubRelease struct { ... PublishedAt time.Time `json:"publishedAt"` ... } ``` According to GitHub: <img width="713" height="49" alt="Image" src="https://github.com/user-attachments/assets/0d394d4f-6f83-4115-9b01-4cd1c0c48991" /> @klesh should we set the fields to `nil`? or should we skip those? I believe those cases relate to the time of the polling, as jobs may have been queued (as an example) which is logical not to have a `startedAt` I believe also the same applies to releases (release was started but not finished as example). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@devlake.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org