MCPcopy
hub / github.com/pelletier/go-toml / assignDateTime

Method assignDateTime

unmarshaler.go:1801–1815  ·  view source on GitHub ↗
(v reflect.Value, value *unstable.Node)

Source from the content-addressed store, hash-verified

1799}
1800
1801func (d *decoder) assignDateTime(v reflect.Value, value *unstable.Node) (reflect.Value, error) {
1802 t, err := parseDateTime(value.Data)
1803 if err != nil {
1804 return reflect.Value{}, err
1805 }
1806
1807 if v.Type() == timeType {
1808 v.Set(reflect.ValueOf(t))
1809 return v, nil
1810 }
1811 if v.Kind() == reflect.Interface {
1812 return boxInto(v, reflect.ValueOf(t))
1813 }
1814 return reflect.Value{}, d.typeMismatchError("datetime", v.Type(), d.p.Raw(value.Raw))
1815}
1816
1817func (d *decoder) assignLocalDateTime(v reflect.Value, value *unstable.Node) (reflect.Value, error) {
1818 dt, rest, err := parseLocalDateTime(value.Data)

Callers 1

assignValueMethod · 0.95

Calls 4

typeMismatchErrorMethod · 0.95
parseDateTimeFunction · 0.85
boxIntoFunction · 0.85
RawMethod · 0.80

Tested by

no test coverage detected