Documentation
¶
Index ¶
- Constants
- Variables
- func Merge(values ...any) json.Marshaler
- func MergeJSON(values ...any) ([]byte, error)
- func RegisterFixedLocation(name string, secondsFromUTC int)
- type DateRangeType
- type DayTime
- type Duration
- type Exampler
- type ISO8601
- func (t ISO8601) Add(d time.Duration) ISO8601
- func (t ISO8601) After(u ISO8601) bool
- func (t ISO8601) Before(u ISO8601) bool
- func (t ISO8601) Equal(u ISO8601) bool
- func (t ISO8601) In(loc *time.Location) ISO8601
- func (t ISO8601) IsZero() bool
- func (t ISO8601) ListExamples() any
- func (t ISO8601) MarshalJSON() ([]byte, error)
- func (t *ISO8601) Scan(src any) error
- func (t ISO8601) String() string
- func (t ISO8601) Sub(u ISO8601) time.Duration
- func (t ISO8601) To24Hour() string
- func (t ISO8601) ToDayTime() DayTime
- func (t ISO8601) ToSimpleDate() SimpleDate
- func (t ISO8601) ToSimpleDateIn(in *time.Location) SimpleDate
- func (t ISO8601) ToTime() time.Time
- func (t *ISO8601) UnmarshalJSON(b []byte) error
- func (t ISO8601) Value() (driver.Value, error)
- type KitchenTime
- type Merged
- type Number
- func (n Number) Float64() float64
- func (n Number) IsNull() bool
- func (n Number) MarshalJSON() ([]byte, error)
- func (n Number) MarshalJSONTo(enc *jsontext.Encoder) error
- func (n *Number) Scan(src any) error
- func (n Number) String() string
- func (n *Number) UnmarshalJSON(data []byte) error
- func (n *Number) UnmarshalJSONFrom(dec *jsontext.Decoder) error
- func (n Number) Value() (driver.Value, error)
- type Season
- type SimpleDate
- func (t SimpleDate) Add(d time.Duration) SimpleDate
- func (t SimpleDate) AddDate(years, months, days int) SimpleDate
- func (t SimpleDate) After(d2 SimpleDate) bool
- func (t SimpleDate) Before(d2 SimpleDate) bool
- func (t SimpleDate) CountPastDays(pastDate SimpleDate) int
- func (t SimpleDate) Equal(d SimpleDate) bool
- func (t SimpleDate) IsZero() bool
- func (t SimpleDate) ListExamples() any
- func (t SimpleDate) MarshalJSON() ([]byte, error)
- func (t SimpleDate) MarshalText() ([]byte, error)
- func (t *SimpleDate) Scan(src any) error
- func (t SimpleDate) String() string
- func (t SimpleDate) ToTime() time.Time
- func (t *SimpleDate) UnmarshalJSON(data []byte) error
- func (t *SimpleDate) UnmarshalText(text []byte) error
- func (t SimpleDate) Value() (driver.Value, error)
- func (t SimpleDate) Weekday() time.Weekday
- type SimpleDates
- func (t SimpleDates) Contains(date SimpleDate) bool
- func (t SimpleDates) DateStrings() []string
- func (t SimpleDates) First() SimpleDate
- func (t SimpleDates) Last() SimpleDate
- func (t *SimpleDates) Scan(src any) error
- func (t SimpleDates) Value() (driver.Value, error)
- func (t SimpleDates) Weekdays() []time.Weekday
- type StringOrArray
- type TimeNotationDuration
- func (d TimeNotationDuration) MarshalJSON() ([]byte, error)
- func (d *TimeNotationDuration) Set(v float64)
- func (d *TimeNotationDuration) SetDuration(dur time.Duration)
- func (d TimeNotationDuration) ToDuration() time.Duration
- func (d *TimeNotationDuration) UnmarshalJSON(b []byte) error
- func (d TimeNotationDuration) Value() (driver.Value, error)
- type Weekday
- func (d Weekday) IsValid() bool
- func (d Weekday) MarshalJSON() ([]byte, error)
- func (d Weekday) MarshalJSONTo(enc *jsontext.Encoder) error
- func (d *Weekday) Scan(src any) error
- func (d Weekday) Std() time.Weekday
- func (d Weekday) String() string
- func (d *Weekday) UnmarshalJSON(data []byte) error
- func (d *Weekday) UnmarshalJSONFrom(dec *jsontext.Decoder) error
- func (d Weekday) Value() (driver.Value, error)
Constants ¶
const ( // ISO8601Layout holds the time layout for the the javascript iso time. // Read more at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString. ISO8601Layout = "2006-01-02T15:04:05" // ISO8601LayoutWithTimezone same as ISO8601Layout but with the timezone suffix. ISO8601LayoutWithTimezone = "2006-01-02T15:04:05Z" // To match Go’s standard time layout that pads zeroes for microseconds, you can use the format 2006-01-02T15:04:05.000000Z07:00. // This layout uses 0s instead of 9s for the fractional second part, which ensures that the microseconds are // always represented with six digits, padding with leading zeroes if necessary. // ISO8601ZUTCOffsetLayoutWithMicroseconds = "2006-01-02T15:04:05.000000Z07:00" // ISO8601ZUTCOffsetLayoutWithMicroseconds ISO 8601 format, with full time and zone with UTC offset. // Example: 2022-08-10T03:21:00.000000+03:00, 2023-02-04T09:48:14+00:00, 2022-08-09T00:00:00.000000. ISO8601ZUTCOffsetLayoutWithMicroseconds = "2006-01-02T15:04:05.999999Z07:00" // ISO8601ZUTCOffsetLayoutWithoutMicroseconds ISO 8601 format, with full time and zone with UTC offset without microsecond precision. ISO8601ZUTCOffsetLayoutWithoutMicroseconds = "2006-01-02T15:04:05Z07:00" // ISO8601UnconventionalOffsetLayout is the layout for the unconventional offset. // Custom offset layout, e.g., 2024-05-21T18:06:07.000000-04:01:19. ISO8601UnconventionalOffsetLayout = "2006-01-02T15:04:05.000000" )
const ( Sunday = Weekday(time.Sunday) Monday = Weekday(time.Monday) Tuesday = Weekday(time.Tuesday) Wednesday = Weekday(time.Wednesday) Thursday = Weekday(time.Thursday) Friday = Weekday(time.Friday) Saturday = Weekday(time.Saturday) )
The seven days, so a call site reads types.Monday rather than types.Weekday(time.Monday). The values are time.Weekday's.
const (
// DayTimeLayout holds the time layout for the the format of "hour:minute:second", hour can be 15, meaning 3 PM.
DayTimeLayout = "15:04:05"
)
const KitchenTimeLayout = "3:04 PM"
KitchenTimeLayout represents the "3:04 PM" Go time format, similar to time.Kitchen.
const (
// SimpleDateLayout represents the "year-month-day" Go time format.
SimpleDateLayout = "2006-01-02"
)
Variables ¶
var ( // ErrInvalid is returned when the value is invalid. ErrInvalid = errors.New("invalid") )
var ErrParseKitchenTimeColon = fmt.Errorf("parse kitchen time: missing ':' character")
Functions ¶
func Merge ¶
Merge takes any number of JSON-serializable objects and returns a json.Marshaler that combines the objects.
Usage:
ctx.JSON(types.Merge(obj1, obj2, obj3))
func MergeJSON ¶
MergeJSON merges a variadic number of values into a single JSON object. Each non-nil value must marshal to a JSON object; a string or []byte value is taken as raw JSON. Nil values and empty objects ("{}") contribute nothing. Values marshal with the framework's JSON policy (see core/pkg/jsonutil), so a struct renders the same here as through ctx.JSON.
A member name present in more than one value appears once in the result, in the position of its first occurrence, with the value of its last occurrence: the later object wins. The output never carries duplicate names, so any strict decoder (the framework's own client included) can read it.
Returns an error if any non-nil value does not marshal to a JSON object.
func RegisterFixedLocation ¶
RegisterFixedLocation should be called on initialization of the program. It registers a fixed location to the time parser.
E.g. for input of 2023-02-04T09:48:14+03:00 to result a time string of 2023-02-04 09:48:14 +0300 EEST you have to RegisterFixedLocation("EEST", 10800) otherwise it will result to: 2023-02-04 09:48:14 +0300 +0300.
Types ¶
type DateRangeType ¶
type DateRangeType string
DateRangeType is the type of the date range.
const ( // DayRange is the date range type of a day. DayRange DateRangeType = "day" // MonthRange is the date range type of a month. MonthRange DateRangeType = "month" // WeekRange is the date range type of a week. WeekRange DateRangeType = "week" // YearRange is the date range type of a year. YearRange DateRangeType = "year" )
type DayTime ¶
DayTime describes a time compatible with DayTimeLayout.
func ParseDayTime ¶
ParseDayTime reads from "s" and returns the DayTime time.
func (DayTime) MarshalJSON ¶
MarshalJSON writes a quoted string in the DayTime time format.
func (DayTime) String ¶
String returns the text representation of the "t" using the DayTime time layout.
func (*DayTime) UnmarshalJSON ¶
UnmarshalJSON parses the "b" into DayTime time.
type Duration ¶
Duration is a JSON representation of the standard Duration type, until Go version 2 supports it under the hood.
func ParseDuration ¶
ParseDuration parses a string to a duration. It is a wrapper around time.ParseDuration.
func (Duration) MarshalJSON ¶
func (Duration) ToDuration ¶
func (*Duration) UnmarshalJSON ¶
type Exampler ¶
type Exampler interface {
ListExamples() any
}
Exampler is an interface used by testing to generate examples.
type ISO8601 ¶
ISO8601 describes a time compatible with javascript time format.
func ParseISO8601 ¶
ParseISO8601 reads from "s" and returns the ISO8601 time.
The function supports the following formats:
- 2024-01-02T15:04:05.999999Z
- 2024-01-02T15:04:05+07:00
- 2024-04-08T08:05:04.830140+00:00
- 2024-01-02T15:04:05Z
- 2024-04-08T08:05:04.830140
- 2024-01-02T15:04:05
- 2024-05-21T18:06:07.000000-04:01:19
func (ISO8601) IsZero ¶
IsZero reports whether "t" is zero time. It completes the pg.Zeroer interface.
func (ISO8601) ListExamples ¶
ListExamples returns a list of example values. It completes the Exampler interface.
func (ISO8601) MarshalJSON ¶
MarshalJSON writes a quoted string in the ISO8601 time format.
func (ISO8601) String ¶
String returns the text representation of the "t" using the ISO8601 time layout.
func (ISO8601) ToSimpleDate ¶
func (t ISO8601) ToSimpleDate() SimpleDate
ToSimpleDate converts the current ISO8601 "t" to SimpleDate.
func (ISO8601) ToSimpleDateIn ¶
func (t ISO8601) ToSimpleDateIn(in *time.Location) SimpleDate
ToSimpleDateIn converts the current ISO8601 "t" to SimpleDate in specific location.
func (*ISO8601) UnmarshalJSON ¶
UnmarshalJSON parses the "b" into ISO8601 time.
type KitchenTime ¶
KitchenTime holds a json "3:04 PM" time.
func ParseKitchenTime ¶
func ParseKitchenTime(s string) (KitchenTime, error)
ParseKitchenTime reads from "s" and returns the KitchenTime time.
func (KitchenTime) IsZero ¶
func (t KitchenTime) IsZero() bool
IsZero reports whether "t" is zero time. It completes the pg.Zeroer interface.
func (KitchenTime) MarshalJSON ¶
func (t KitchenTime) MarshalJSON() ([]byte, error)
MarshalJSON returns the json representation of the "t".
func (*KitchenTime) Scan ¶
func (t *KitchenTime) Scan(src any) error
Scan completes the pg and native sql driver.Scanner interface reading functionality of a custom type.
func (KitchenTime) String ¶
func (t KitchenTime) String() string
String returns the text representation of the date formatted based on the `KitchenTimeLayout`. If date is zero it returns an empty string.
func (KitchenTime) To24Hour ¶
func (t KitchenTime) To24Hour() string
To24Hour returns the 24-hour representation of the time.
func (*KitchenTime) UnmarshalJSON ¶
func (t *KitchenTime) UnmarshalJSON(data []byte) error
UnmarshalJSON binds the json "data" to "t" with the `KitchenTimeLayout`.
func (KitchenTime) Value ¶
func (t KitchenTime) Value() time.Time
Value returns the standard time type.
type Merged ¶
type Merged struct {
Values []any
}
Merged holds a slice of JSON-serializable objects to be Merged together.
func (Merged) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for the merged type.
type Number ¶
type Number float64
Number is a float64 which has a JSON null: NaN and the two infinities marshal as null and a JSON null unmarshals back to NaN. A plain float64 cannot do that, because encoding/json refuses to encode a value which JSON has no literal for, and a computed average or ratio produces those values often enough that the whole document would fail to render.
The zero value is the number zero, not null. Use NullNumber for the null one and IsNull to test for it.
On the database side the same rule holds: a NULL column scans to NaN and a NaN value is written as NULL, so a float8 column and this type agree on what "no value" means.
func NullNumber ¶
func NullNumber() Number
NullNumber returns the null Number, the one which marshals as null and is written to the database as NULL.
func (Number) Float64 ¶
Float64 returns the number as a float64. A null Number returns NaN, so check IsNull first when the difference matters.
func (Number) IsNull ¶
IsNull reports whether the number has no value: NaN, or one of the two infinities, all of which render as null.
func (Number) MarshalJSON ¶
MarshalJSON renders the number for encoding/json (v1) interop: a downstream logger or a v1 encoder gets the same bytes MarshalJSONTo writes.
func (Number) MarshalJSONTo ¶
MarshalJSONTo writes the number straight into the encoder, which is the path ctx.JSON takes, with no intermediate byte slice.
func (*Number) Scan ¶
Scan completes the sql.Scanner interface. A NULL column becomes NaN, so a nullable float8 needs no sql.NullFloat64 wrapper. Text-mode drivers give the value as a string or as raw bytes; both are parsed.
An empty text is an error and not a null: a number column which holds no value holds NULL, and empty text from a numeric column means the driver gave something unexpected. Weekday, whose column is text, takes the opposite view and leaves the value alone.
func (Number) String ¶
String returns the JSON text of the number, and "null" when it has no value. It is the encoder's own formatter, so String, MarshalJSON and MarshalJSONTo always agree: a large value renders as 1e+21 on all three, where a plain strconv 'f' would write it out in full on one of them only.
func (*Number) UnmarshalJSON ¶
UnmarshalJSON reads the number for encoding/json (v1) interop. A JSON null becomes NaN.
A quoted number is rejected here as it is by UnmarshalJSONFrom: the two paths accept exactly the same documents, so a payload cannot decode under one encoder and fail under the other.
func (*Number) UnmarshalJSONFrom ¶
UnmarshalJSONFrom reads the number from the decoder. A JSON null becomes NaN, the value this type calls null.
type Season ¶
type Season int
Season is a bitmask of seasons Winter, Spring, Summer, Autumn. It is used to represent the seasons of a year. It is a bitmask so that multiple seasons can be set at once. It has methods to check if a season is set, add a season, remove a season, and get a string representation of the seasons.
const ( // December, January, February. Winter Season = 1 << iota // 1 << 0 = 1 // March, April, May. Spring // 1 << 1 = 2 // June, July, August. Summer // 1 << 2 = 4 // September, October, November. Autumn // 1 << 3 = 8 // AllSeasons is a bitmask of all seasons. // It's the number 15 because it's the sum of all seasons. AllSeasons = Winter | Spring | Summer | Autumn // 1 + 2 + 4 + 8 = 15 )
func GetSeasonByDate ¶
func GetSeasonByDate(date SimpleDate) Season
GetSeasonByDate returns the season based on the given date.
func (*Season) UnmarshalJSON ¶
UnmarshalJSON parses the JSON value into a Season bitmask. The value is read as an integer, a zero value means AllSeasons. It returns ErrInvalid if the resulting bitmask is not a valid Season.
type SimpleDate ¶
SimpleDate holds a json "year-month-day" time.
func ParseSimpleDate ¶
func ParseSimpleDate(s string) (SimpleDate, error)
ParseSimpleDate reads from "s" and returns the SimpleDate time.
The function supports the following formats:
- "2024-01-01"
- "2024-1-1"
func SimpleDateFromTime ¶
func SimpleDateFromTime(t time.Time) SimpleDate
SimpleDateFromTime accepts a "t" Time and returns a SimpleDate. If format fails, it returns the zero value of time.Time.
func (SimpleDate) Add ¶
func (t SimpleDate) Add(d time.Duration) SimpleDate
Add returns the date of "t" plus "d".
func (SimpleDate) AddDate ¶
func (t SimpleDate) AddDate(years, months, days int) SimpleDate
AddDate returns the date of "t" plus "years", "months" and "days".
func (SimpleDate) After ¶
func (t SimpleDate) After(d2 SimpleDate) bool
After reports whether the time instant t is after u.
func (SimpleDate) Before ¶
func (t SimpleDate) Before(d2 SimpleDate) bool
Before reports whether the time instant t is before u.
func (SimpleDate) CountPastDays ¶
func (t SimpleDate) CountPastDays(pastDate SimpleDate) int
CountPastDays returns the count of days between "t" and "pastDate".
func (SimpleDate) Equal ¶
func (t SimpleDate) Equal(d SimpleDate) bool
Equal reports back if "t" and "d" equals to the same date.
func (SimpleDate) IsZero ¶
func (t SimpleDate) IsZero() bool
IsZero reports whether "t" is zero time. It completes the pg.Zeroer interface.
func (SimpleDate) ListExamples ¶
func (t SimpleDate) ListExamples() any
ListExamples returns a list of example values. It completes the Exampler interface.
func (SimpleDate) MarshalJSON ¶
func (t SimpleDate) MarshalJSON() ([]byte, error)
MarshalJSON returns the json representation of the "t".
func (SimpleDate) MarshalText ¶ added in v14.0.1
func (t SimpleDate) MarshalText() ([]byte, error)
MarshalText returns the "2006-01-02" text of "t", empty for the zero date.
It completes the encoding.TextMarshaler interface. An encoder that reads through UnmarshalText, such as msgpack, has to write through this one: without it the date is written as an empty map that it cannot read back.
func (*SimpleDate) Scan ¶
func (t *SimpleDate) Scan(src any) error
Scan completes the pg and native sql driver.Scanner interface reading functionality of a custom type.
func (SimpleDate) String ¶
func (t SimpleDate) String() string
String returns the text representation of the date formatted based on the `SimpleDateLayout`. If date is zero it returns an empty string.
func (SimpleDate) ToTime ¶
func (t SimpleDate) ToTime() time.Time
ToTime returns the standard time type.
func (*SimpleDate) UnmarshalJSON ¶
func (t *SimpleDate) UnmarshalJSON(data []byte) error
UnmarshalJSON binds the json "data" to "t" with the `SimpleDateLayout`.
func (*SimpleDate) UnmarshalText ¶ added in v14.0.1
func (t *SimpleDate) UnmarshalText(text []byte) error
UnmarshalText parses a "2006-01-02" text into "t", with the same `SimpleDateLayout` the json decoding uses. An empty text leaves "t" as it is.
It completes the encoding.TextUnmarshaler interface, which is how the Context's ReadQuery, ReadParams, ReadURL, ReadForm and ReadHeader fill a SimpleDate struct field.
func (SimpleDate) Value ¶
func (t SimpleDate) Value() (driver.Value, error)
Value completes the pg and native sql driver.Valuer interface.
func (SimpleDate) Weekday ¶
func (t SimpleDate) Weekday() time.Weekday
Weekday returns the day of the week for the date.
type SimpleDates ¶
type SimpleDates []SimpleDate
SimpleDates is a slice of SimpleDate.
func GetSimpleDateRange ¶
func GetSimpleDateRange(date SimpleDate, typ DateRangeType, startWeekday, endWeekday time.Weekday) SimpleDates
GetSimpleDateRange returns a slice of SimpleDate between the "start" and "end" of "date" based on given "typ". Only WeekRange and MonthRange are supported, any other value, including DayRange and YearRange, panics. The "startWeekday" and "endWeekday" arguments are used by WeekRange only.
Example Code: date := types.SimpleDateFromTime(time.Now()) dates := types.GetSimpleDateRange(date, types.WeekRange, time.Monday, time.Sunday)
func (SimpleDates) Contains ¶
func (t SimpleDates) Contains(date SimpleDate) bool
Contains reports if the "date" exists inside "t".
func (SimpleDates) DateStrings ¶
func (t SimpleDates) DateStrings() []string
DateStrings returns a slice of string representation of the dates.
func (SimpleDates) First ¶
func (t SimpleDates) First() SimpleDate
First returns the first element of the date slice.
func (SimpleDates) Last ¶
func (t SimpleDates) Last() SimpleDate
Last returns the last element of the date slice.
func (*SimpleDates) Scan ¶
func (t *SimpleDates) Scan(src any) error
Scan completes the pg and native sql driver.Scanner interface.
func (SimpleDates) Value ¶
func (t SimpleDates) Value() (driver.Value, error)
Value completes the pg and native sql driver.Valuer interface.
func (SimpleDates) Weekdays ¶
func (t SimpleDates) Weekdays() []time.Weekday
Weekdays returns a slice of unique weekdays from the dates in "t".
type StringOrArray ¶
type StringOrArray string
StringOrArray type can be a single string or an array of strings. It marshals and unmarshals as a single string joined by commas.
func (StringOrArray) MarshalJSON ¶
func (soa StringOrArray) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the type.
func (StringOrArray) String ¶
func (soa StringOrArray) String() string
String returns the string representation of the type.
func (*StringOrArray) UnmarshalJSON ¶
func (soa *StringOrArray) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the value of the type from JSON.
type TimeNotationDuration ¶
TimeNotationDuration is a JSON representation of the standard Duration type in 00:00:00 (hour, minute seconds).
func ParseTimeNotationDuration ¶
func ParseTimeNotationDuration(s string) (TimeNotationDuration, error)
ParseTimeNotationDuration parses a string to a time notation duration (00:00:00) hours:minutes:seconds.
func (TimeNotationDuration) MarshalJSON ¶
func (d TimeNotationDuration) MarshalJSON() ([]byte, error)
func (*TimeNotationDuration) Set ¶
func (d *TimeNotationDuration) Set(v float64)
Set sets the value of duration in nanoseconds.
func (*TimeNotationDuration) SetDuration ¶
func (d *TimeNotationDuration) SetDuration(dur time.Duration)
SetDuration sets the value of duration in time.Duration.
func (TimeNotationDuration) ToDuration ¶
func (d TimeNotationDuration) ToDuration() time.Duration
func (*TimeNotationDuration) UnmarshalJSON ¶
func (d *TimeNotationDuration) UnmarshalJSON(b []byte) error
type Weekday ¶
Weekday is a time.Weekday which travels as a lowercase name: "monday". A client reading a schedule gets a word it can print, not a number whose base it has to guess, and the JSON stays readable in a log.
The numbering is time.Weekday's, Sunday being zero, so a Weekday converts to and from the standard type for free:
d := types.WeekdayOf(t.Weekday()) t.Weekday() == d.Std()
Because Sunday is the zero value, the zero Weekday marshals as "sunday".
func ParseWeekday ¶
ParseWeekday reads a weekday from its name, in any case and in the long or the three letter form: "Monday", "monday", "MON" and "mon" are the same day. Surrounding space is ignored.
func WeekdayOf ¶
WeekdayOf converts a standard time.Weekday into this type. It is the opposite direction of the Std method.
func (Weekday) MarshalJSON ¶
MarshalJSON renders the day name for encoding/json (v1) interop.
func (Weekday) MarshalJSONTo ¶
MarshalJSONTo writes the day name straight into the encoder, which is the path ctx.JSON takes, with no intermediate byte slice.
func (*Weekday) Scan ¶
Scan completes the sql.Scanner interface. A text column is parsed by name, an integer one by time.Weekday's numbering and a NULL leaves the value as it is, as an empty text does: an absent value is not a wrong one. Number, whose column is numeric, takes the opposite view and makes an empty text an error.
func (Weekday) Std ¶
Std returns the standard library type. It is named Std and not ToWeekday because a "ToWeekday" in the wild converts into a weekday type rather than out of one, and having both directions under one name during a migration is how the wrong one gets called. WeekdayOf is the other direction.
func (Weekday) String ¶
String returns the lowercase English name of the day ("monday"). An out of range value renders like the standard library's, so a bad value is visible in a log instead of silently reading as a Sunday.
func (*Weekday) UnmarshalJSON ¶
UnmarshalJSON reads the day name for encoding/json (v1) interop.
func (*Weekday) UnmarshalJSONFrom ¶
UnmarshalJSONFrom reads the day name from the decoder. A JSON null and an empty text leave the value as it is, matching the rest of this package.