feat(12.2-01): add lagoon.Date and lagoon.TimeOfDay with Fill and required support
- Date (DATE) and TimeOfDay (TIME) with Scanner, Valuer, JSON and text forms - Fill falls back to encoding.TextUnmarshaler for string sources after every existing conversion, so time.Time and the new types fill from JSON - required treats a zero time.Time, Date or TimeOfDay as empty - lagoon README, models and casts-and-validation docs
This commit is contained in:
@@ -69,7 +69,7 @@ if errors.As(err, &typeErr) {
|
||||
// invalid value for views
|
||||
```
|
||||
|
||||
`lagoon.Fill` matches keys by the GORM column name, not the Go field name. A number decoded with `json.Decoder.UseNumber` fills integer and float fields; a fraction or an overflow for an integer field is a `lagoon.FillTypeError`.
|
||||
`lagoon.Fill` matches keys by the GORM column name, not the Go field name. A number decoded with `json.Decoder.UseNumber` fills integer and float fields; a fraction or an overflow for an integer field is a `lagoon.FillTypeError`. A string fills a date or time column: an RFC 3339 timestamp such as `2026-10-02T12:30:00Z` fills a `time.Time` or `*time.Time` field, `2026-10-02` a `lagoon.Date` and `14:30:00` a `lagoon.TimeOfDay`, pointer variants included, so a model needs no date type of its own. A string that does not parse is a `lagoon.FillTypeError`. See [Date and time columns](casts-and-validation.md#date-and-time-columns).
|
||||
|
||||
## Creating a record
|
||||
|
||||
|
||||
Reference in New Issue
Block a user