// UnmarshalText implements encoding.TextUnmarshaler.
163076
func (hb *HEXBytes) UnmarshalText(text []byte) error {
	b, err := hex.DecodeString(string(text))
	if err != nil {
		return err
	}
	*hb = HEXBytes(b)
	return nil
}
932052
func (t *Time) UnmarshalText(in []byte) error {
	parsed, err := time.Parse(time.RFC3339Nano, string(in))
	if err != nil {
		return err
	}
	t.Time = parsed
	return nil
}
794731
func (t *UnixTime) UnmarshalText(raw []byte) error {
	var unmarshaled time.Time

	if err := unmarshaled.UnmarshalText(raw); err != nil {
		return err
	}

	*t = UnixTime(unmarshaled)
	return nil
}
1174466
func (pe *PathExp) UnmarshalText(b []byte) error {
	o, err := Parse(string(b))
	if err != nil {
		return err
	}

	pe.Org = o.Org
	pe.Project = o.Project
	pe.Envs = o.Envs
	pe.Services = o.Services
	pe.Instances = o.Instances
	pe.Identities = o.Identities

	return nil
}
809990
func (b *Bytes) UnmarshalText(input []byte) error {
	raw, err := checkText(input, true)
	if err != nil {
		return err
	}
	dec := make([]byte, len(raw)/2)
	if _, err = hex.Decode(dec, raw); err != nil {
		err = mapError(err)
	} else {
		*b = dec
	}
	return err
}
759453
func (u *Unmarshaler) UnmarshalNext(dec *json.Decoder, pb proto.Message) error {
	inputValue := json.RawMessage{}
	if err := dec.Decode(&inputValue); err != nil {
		return err
	}
	if err := u.unmarshalValue(reflect.ValueOf(pb).Elem(), inputValue, nil); err != nil {
		return err
	}
	return checkRequiredFields(pb)
}
1323886
func (k *OrderAwareKey) UnmarshalText(text []byte) error {
	i := atomic.AddUint64(&keyOrderCounter, 1)
	k.Order = i
	k.Key = string(text)
	return nil
}
398858
func (i *HexOrDecimal64) UnmarshalText(input []byte) error {
	int, ok := ParseUint64(string(input))
	if !ok {
		return fmt.Errorf("invalid hex or decimal integer %q", input)
	}
	*i = HexOrDecimal64(int)
	return nil
}
812044
func (u *UUID) UnmarshalText(text []byte) (err error) {
	if len(text) < 32 {
		err = fmt.Errorf("uuid: UUID string too short: %s", text)
		return
	}

	t := text[:]
	braced := false

	if bytes.Equal(t[:9], urnPrefix) {
		t = t[9:]
	} else if t[0] == '{' {
		braced = true
		t = t[1:]
	}

	b := u[:]

	for i, byteGroup := range byteGroups {
		if i > 0 {
			if t[0] != '-' {
				err = fmt.Errorf("uuid: invalid string format")
				return
			}
			t = t[1:]
		}

		if len(t) < byteGroup {
			err = fmt.Errorf("uuid: UUID string too short: %s", text)
			return
		}

		if i == 4 && len(t) > byteGroup &&
			((braced && t[byteGroup] != '}') || len(t[byteGroup:]) > 1 || !braced) {
			err = fmt.Errorf("uuid: UUID string too long: %s", text)
			return
		}

		_, err = hex.Decode(b[:byteGroup/2], t[:byteGroup])
		if err != nil {
			return
		}

		t = t[byteGroup:]
		b = b[byteGroup/2:]
	}

	return
}
942787
func (s *UUID) UnmarshalText(text []byte) error {
	var ss []string
	for _, x := range strings.Split(string(text), ",") {
		ss = append(ss, strings.TrimSpace(x))
	}
	us, err := strSliceToUUIDSlice(ss)
	if err != nil {
		return errors.WithStack(err)
	}
	*s = us
	return nil
}
1004449
func (l *Level) UnmarshalText(text []byte) (err error) {
	if bytes.Equal(text, levelBytesDebug) {
		*l = LevelDebug
	} else if bytes.Equal(text, levelBytesInfo) {
		*l = LevelInfo
	} else if bytes.Equal(text, levelBytesWarn) {
		*l = LevelWarn
	} else if bytes.Equal(text, levelBytesError) {
		*l = LevelError
	} else if bytes.Equal(text, levelBytesFatal) {
		*l = LevelFatal
	} else {
		err = fmt.Errorf("Uknown level %v", string(text))
	}
	return
}
898573
func (d *Duration) UnmarshalText(text []byte) error {
	return d.Set(string(text))
}
1120075
func (s *String) UnmarshalText(text []byte) error {
	r := csv.NewReader(bytes.NewReader(text))

	var words []string
	for {
		record, err := r.Read()
		if err == io.EOF {
			break
		}
		if err != nil {
			return err
		}

		words = append(words, record...)
	}

	*s = String(words)
	return nil
}
403169
func (c *Code) UnmarshalText(text []byte) error {
	i, ok := _stringToCode[strings.ToLower(string(text))]
	if !ok {
		return fmt.Errorf("unknown code string: %s", string(text))
	}
	*c = i
	return nil
}
998492
func (datr *DataRate) UnmarshalText(data []byte) error {
	parsed, err := ParseDataRate(string(data))
	if err != nil {
		return err
	}
	*datr = *parsed
	return nil
}
1142155
func (k *AES128Key) UnmarshalText(text []byte) error {
	b, err := hex.DecodeString(string(text))
	if err != nil {
		return err
	}
	if len(b) != len(k) {
		return fmt.Errorf("lorawan: exactly %d bytes are expected", len(k))
	}
	copy(k[:], b)
	return nil
}
1369945
func (e *EUI64) UnmarshalText(text []byte) error {
	b, err := hex.DecodeString(string(text))
	if err != nil {
		return err
	}
	if len(e) != len(b) {
		return fmt.Errorf("lorawan: exactly %d bytes are expected", len(e))
	}
	copy(e[:], b)
	return nil
}