ChickenBenny commented on code in PR #75737:
URL: https://github.com/apache/airflow/pull/75737#discussion_r4509226093


##########
go-sdk/pkg/execution/genmodels/time.go:
##########
@@ -0,0 +1,68 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package genmodels
+
+import (
+       "time"
+
+       "github.com/vmihailenco/msgpack/v5"
+)
+
+// Time is a schema date-time. The supervisor's msgpack timestamp carries no
+// zone and msgpack decodes it with time.Unix, i.e. in the worker's local zone,
+// while Airflow means UTC.
+//
+// A string must carry an offset (RFC 3339). A naive one is rejected rather 
than
+// read as UTC: it names no zone, and Airflow refuses to store naive datetimes.
+//
+// A defined type inherits none of time.Time's methods, so Time restates the
+// ones it needs: EncodeMsgpack (else it encodes as an empty map), IsZero (so
+// omitempty treats Time and *Time as it does time.Time: without it a Time is
+// always dropped and a *Time to the zero time is kept) and String (for fmt).
+type Time time.Time

Review Comment:
   Added MarshalText, plus UnmarshalText so it round-trips. Same rules as the 
msgpack string path: UTC, offset required.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to