func (t Timestamp) Value() time.Time {
	if t.IsNull() || !t.value.IsZero() {
		return t.value
	}

	if len(t.text) > 0 {
		if t.precision == 0 {
			t.precision = determinePrecision(t.text)
		}

		text := bytes.TrimSuffix(t.text, []byte("Z"))
		// TODO: Handle the unknown local offset case properly.
		// -00:00 is a special offset which means that the offset is local.
		text = bytes.TrimSuffix(text, []byte("-00:00"))

		format := precisionFormatMap[t.precision]
		if bytes.Count(text, []byte("-")) == 3 || bytes.LastIndex(text, []byte("+")) > 0 {
			format += "-07:00"
		}

		// The "T" is optional when the precision is month or day, so add it
		// to the text if it's missing so that the Time parser doesn't fail.
		if (t.precision == TimestampPrecisionMonth || t.precision == TimestampPrecisionDay) && !bytes.HasSuffix(text, []byte("T")) {
			text = append(text, 'T')
		}

		timestamp, err := time.Parse(format, string(text))
		if err != nil {
			panic(errors.Wrap(err, "unable to parse timestamp"))
		}
		t.value = timestamp
	}

	return t.value
}
// Value returns the value of the timestamp.
Value returns the value of the timestamp.
// Value returns the value of the timestamp .
func (t Timestamp) Value() time.Time {
	if t.IsNull() || !t.value.IsZero() {
		return t.value
	}
	if len(t.text) > 0 {
		if t.precision == 0 {
			t.precision = determinePrecision(t.text)
		}
		text := bytes.TrimSuffix(t.text, []byte("Z"))
		text = bytes.TrimSuffix(text, []byte("-00:00"))
		format := precisionFormatMap[t.precision]
		if bytes.Count(text, []byte("-")) == 3 || bytes.LastIndex(text, []byte("+")) > 0 {
			format += "-07:00"
		}
		if (t.precision == TimestampPrecisionMonth || t.precision == TimestampPrecisionDay) && !bytes.HasSuffix(text, []byte("T")) {
			text = append(text, 'T')
		}
		timestamp, err := time.Parse(format, string(text))
		if err != nil {
			panic(errors.Wrap(err, "unable to parse timestamp"))
		}
		t.value = timestamp
	}
	return t.value
}
func ( t Timestamp ) Value ( ) time . Time { if t . IsNull ( ) || ! t . value . IsZero ( ) { return t . value } if len ( t . text ) > 0 { if t . precision == 0 { t . precision = determinePrecision ( t . text ) } text := bytes . TrimSuffix ( t . text , [ ] byte ( " " ) ) text = bytes . TrimSuffix ( text , [ ] byte ( " " ) ) format := precisionFormatMap [ t . precision ] if bytes . Count ( text , [ ] byte ( " " ) ) == 3 || bytes . LastIndex ( text , [ ] byte ( " " ) ) > 0 { format += " " } if ( t . precision == TimestampPrecisionMonth || t . precision == TimestampPrecisionDay ) && ! bytes . HasSuffix ( text , [ ] byte ( " " ) ) { text = append ( text , 'T' ) } timestamp , err := time . Parse ( format , string ( text ) ) if err != nil { panic ( errors . Wrap ( err , " " ) ) } t . value = timestamp } return t . value }
Value returns the value of the timestamp.
Value returns the value of the timestamp .
// TODO: Handle the unknown local offset case properly. // -00:00 is a special offset which means that the offset is local. // The "T" is optional when the precision is month or day, so add it // to the text if it's missing so that the Time parser doesn't fail.