Ejemplo n.º 1
0
// InsertB sets the B field to string k, which it is assumed the caller has
// already encoded.
func (a *AttributeValue) InsertB(k string) error {
	if a == nil {
		return errors.New("AttributeValue.InsertB: pointer receiver is nil")
	}
	berr := cast.AWSParseBinary(k)
	if berr != nil {
		return berr
	}
	a.B = k
	return nil
}
Ejemplo n.º 2
0
// InsertBS adds a new base64 string to the bs (JSON: BS) set.
// String is parsed to make sure it is a represents a valid base64 blob.
// BS is *generated* from an internal representation (UM_bs)
// as it transforms a map into a list (a "set").
// The argument is assumed to be already encoded by the caller.
func (a *AttributeValue) InsertBS(k string) error {
	if a == nil {
		return errors.New("AttributeValue.InsertBS: pointer receiver is nil")
	}
	berr := cast.AWSParseBinary(k)
	if berr != nil {
		return berr
	}
	for _, v := range a.BS {
		if v == k {
			return nil
		}
	}
	a.BS = append(a.BS, k)
	return nil
}