// Add adds a new invalid parameter error to the collection of invalid
// parameters. The context of the invalid parameter will be updated to reflect
// this collection.
335778
func (e *ErrInvalidParams) Add(err ErrInvalidParam) {
	err.SetContext(e.Context)
	e.errs = append(e.errs, err)
}
443333
func (o *queryM2M) Add(mds ...interface{}) (int64, error) {
	fi := o.fi
	mi := fi.relThroughModelInfo
	mfi := fi.reverseFieldInfo
	rfi := fi.reverseFieldInfoTwo

	orm := o.qs.orm
	dbase := orm.alias.DbBaser

	var models []interface{}
	var otherValues []interface{}
	var otherNames []string

	for _, colname := range mi.fields.dbcols {
		if colname != mfi.column && colname != rfi.column && colname != fi.mi.fields.pk.column &&
			mi.fields.columns[colname] != mi.fields.pk {
			otherNames = append(otherNames, colname)
		}
	}
	for i, md := range mds {
		if reflect.Indirect(reflect.ValueOf(md)).Kind() != reflect.Struct && i > 0 {
			otherValues = append(otherValues, md)
			mds = append(mds[:i], mds[i+1:]...)
		}
	}
	for _, md := range mds {
		val := reflect.ValueOf(md)
		if val.Kind() == reflect.Slice || val.Kind() == reflect.Array {
			for i := 0; i < val.Len(); i++ {
				v := val.Index(i)
				if v.CanInterface() {
					models = append(models, v.Interface())
				}
			}
		} else {
			models = append(models, md)
		}
	}

	_, v1, exist := getExistPk(o.mi, o.ind)
	if exist == false {
		panic(ErrMissPK)
	}

	names := []string{mfi.column, rfi.column}

	values := make([]interface{}, 0, len(models)*2)
	for _, md := range models {

		ind := reflect.Indirect(reflect.ValueOf(md))
		var v2 interface{}
		if ind.Kind() != reflect.Struct {
			v2 = ind.Interface()
		} else {
			_, v2, exist = getExistPk(fi.relModelInfo, ind)
			if exist == false {
				panic(ErrMissPK)
			}
		}
		values = append(values, v1, v2)

	}
	names = append(names, otherNames...)
	values = append(values, otherValues...)
	return dbase.InsertValue(orm.db, mi, true, names, values)
}
895071
func (t *SwitchesTable) add(c context.Context) error {
	// Avoid using the database connection to prepare unnecessary statements.
	if len(t.additions) == 0 {
		return nil
	}

	db := database.Get(c)
	stmt, err := db.PrepareContext(c, `
		INSERT INTO switches (name, description, ports, state, rack_id)
		VALUES (?, ?, ?, ?, ?)
	`)
	if err != nil {
		return errors.Annotate(err, "failed to prepare statement").Err()
	}
	defer stmt.Close()

	// Add each switch to the database, and update the slice of switches with each addition.
	for len(t.additions) > 0 {
		s := t.additions[0]
		result, err := stmt.ExecContext(c, s.Name, s.Description, s.Ports, s.State, s.RackId)
		if err != nil {
			return errors.Annotate(err, "failed to add switch %q", s.Name).Err()
		}
		t.current = append(t.current, s)
		t.additions = t.additions[1:]
		logging.Infof(c, "Added switch %q", s.Name)
		s.Id, err = result.LastInsertId()
		if err != nil {
			return errors.Annotate(err, "failed to get switch ID %q", s.Name).Err()
		}
	}
	return nil
}
462034
func (set IdentifierSet) Add(i Identifier) bool {
	_, found := set[i]
	set[i] = struct{}{}
	return !found //False if it existed already
}
914866
func (e *LoggingErrorGroup) Add(err error) {
	e.total++
	if err != nil {
		LogMethod("%s: %s", e.name, err)
		e.failed++
	}
}
105073
func (s *triggersSet) Add(c context.Context, triggers []*internal.Trigger) error {
	items := make([]dsset.Item, 0, len(triggers))
	for _, t := range triggers {
		blob, err := proto.Marshal(t)
		if err != nil {
			return fmt.Errorf("failed to marshal proto - %s", err)
		}
		items = append(items, dsset.Item{
			ID:    t.Id,
			Value: blob,
		})
	}
	return s.Set.Add(c, items)
}
741586
func (s *Set) Add(els ...string) Set {
	if *s == nil {
		*s = make(Set)
	}
	for _, el := range els {
		(*s)[el] = struct{}{}
	}

	return *s
}
148982
func (s *MgetService) Add(items ...*MultiGetItem) *MgetService {
	s.items = append(s.items, items...)
	return s
}
1103046
func (s *Set) Add(v interface{}) {
	s.once.Do(s.init)
	s.m[hashcode(v)] = v
}
573873
func (e *Err) Add(key string, value interface{}) {
	if e.data == nil {
		e.data = Data{}
	}
	e.data[key] = value
}
1270630
func (t *VLANsTable) add(c context.Context) error {
	// Avoid using the database connection to prepare unnecessary statements.
	if len(t.additions) == 0 {
		return nil
	}

	db := database.Get(c)
	stmt, err := db.PrepareContext(c, `
		INSERT INTO vlans (id, alias, state, cidr_block)
		VALUES (?, ?, ?, ?)
	`)
	if err != nil {
		return errors.Annotate(err, "failed to prepare statement").Err()
	}
	defer stmt.Close()

	// Add each VLAN to the database, and update the slice of VLANs with each addition.
	for len(t.additions) > 0 {
		vlan := t.additions[0]
		_, err := stmt.ExecContext(c, vlan.Id, vlan.Alias, vlan.State, vlan.CidrBlock)
		if err != nil {
			return errors.Annotate(err, "failed to add VLAN %d", vlan.Id).Err()
		}
		t.current = append(t.current, vlan)
		t.additions = t.additions[1:]
		logging.Infof(c, "Added VLAN %d", vlan.Id)
	}
	return nil
}
359170
func (set *Set) Add(items ...interface{}) {
	set.lock.Lock()
	defer set.lock.Unlock()

	set.flattened = nil
	for _, item := range items {
		set.items[item] = struct{}{}
	}
}
442205
func (s *ReactionsService) Add(name string) *ReactionsAddCall {
	var call ReactionsAddCall
	call.service = s
	call.name = name
	return &call
}
1296288
func (es *MultiError) Add(err error) {
	if err == nil {
		return
	}
	if merr, ok := err.(MultiError); ok {
		*es = append(*es, merr...)
	} else {
		*es = append(*es, err)
	}
}
343464
func (d *Dictionary) Add(key, value interface{}) {
	d.keys = append(d.keys, key)
	d.values = append(d.values, value)
}
1184393
func (s *set) Add(vs ...interface{}) {
	for _, v := range vs {
		s.values[v] = struct{}{}
	}
}
1277780
func (g *Mutable) Add(v, w int) {
	g.AddCost(v, w, 0)
}