// ByCode returns an custattr.Attributer by code. Use type assertion. func (s AttributeSlice) ByCode(g eav.AttributeGetter, code string) (interface{}, error) { if g == nil { panic("AttributeGetter is nil") } i, err := g.ByCode(code) if err != nil { return nil, errgo.Mask(err) } return s[i], nil }
// ByID returns an custattr.Attributer by int64 id. Use type assertion. func (s AttributeSlice) ByID(g eav.AttributeGetter, id int64) (interface{}, error) { if g == nil { panic("AttributeGetter is nil") } i, err := g.ByID(id) if err != nil { return nil, errgo.Mask(err) } return s[i], nil }