Ejemplo n.º 1
0
// InsertN sets the N field to number string k
func (a *AttributeValue) InsertN(k string) error {
	if a == nil {
		return errors.New("AttributeValue.InsertN: pointer receiver is nil")
	}
	fs, ferr := cast.AWSParseFloat(k)
	if ferr != nil {
		return ferr
	}
	a.N = fs
	return nil
}
Ejemplo n.º 2
0
// InsertNS adds a new number string to the ns (JSON: NS) set.
// String is parsed to make sure it is a represents a valid float.
// NS is *generated* from an internal representation (UM_ns)
// as it transforms a map into a list (a "set")
func (a *AttributeValue) InsertNS(k string) error {
	if a == nil {
		return errors.New("AttributeValue.InsertNS: pointer receiver is nil")
	}
	fs, ferr := cast.AWSParseFloat(k)
	if ferr != nil {
		return ferr
	}
	for _, v := range a.NS {
		if v == fs {
			return nil
		}
	}
	a.NS = append(a.NS, fs)
	return nil
}