// Add adds a ColumnElem to the ColumnSet, returning an error if the name
// already exists.
322521
func (set ColumnSet) Add(c ColumnElem) error {
	if _, exists := set[c.name]; exists {
		return fmt.Errorf(
			"aspect: column with the name %s already exists",
			c.name,
		)
	}
	set[c.name] = c
	return nil
}
92128
func (fk ForeignKeyElem) Modify(t *TableElem) error {
	if t == nil {
		return fmt.Errorf("aspect: columns cannot modify a nil table")
	}

	if fk.table != nil {
		return fmt.Errorf(
			"aspect: foreign keys cannot be assigned to multiple tables",
		)
	}
	fk.table = t

	// Column names must validate
	if err := validateColumnName(fk.name); err != nil {
		return err
	}

	// Create the column for this table
	column := ColumnElem{
		inner: ColumnClause{name: fk.name, table: t},
		name:  fk.name,
		table: t,
		typ:   fk.typ,
	}

	// Add the column to the unique set of columns for this table
	if duplicate := t.C.Add(column); duplicate != nil {
		return duplicate
	}

	// Add the name to the table order
	t.order = append(t.order, column.name)

	// Add the fk to the create array
	t.creates = append(t.creates, fk)

	// Add it to the list of foreign keys
	t.fks = append(t.fks, fk)

	return nil
}
391005
func (c ColumnElem) Compile(d Dialect, params *Parameters) (string, error) {
	var compiled string
	var err error
	if c.inner == nil {
		// Old behavior
		compiled, err = fmt.Sprintf(`"%s"."%s"`, c.table.name, c.name), nil
	} else {
		compiled, err = c.inner.Compile(d, params)
	}
	if err != nil {
		return compiled, err
	}
	if c.alias != "" {
		compiled += fmt.Sprintf(` AS "%s"`, c.alias)
	}
	return compiled, nil
}
145424
func (b *UpdateBuilder) AddNamed(column, name string) *UpdateBuilder {
	return b.addValue(column, param(name))
}
901775
func (set StringSet) Add(i string) bool {
	_, found := set[i]
	set[i] = struct{}{}
	return !found //False if it e  xisted already
}
1349962
func (s *set) Add(items ...interface{}) {
	if len(items) == 0 {
		return
	}

	for _, item := range items {
		s.m[item] = keyExists
	}
}
318303
func Column(name string, t Type) ColumnElem {
	// Set the inner clause of the column to the incomplete ColumnClause.
	// This will be overwritten by the table modify function.
	return ColumnElem{
		inner: ColumnClause{name: name},
		name:  name,
		typ:   t,
	}
}
714908
func (idx *Index) AddColumn(name string, cardinality uint64) {
	idx.Columns = append(idx.Columns, sqlparser.NewColIdent(name))
	if cardinality == 0 {
		cardinality = uint64(len(idx.Cardinality) + 1)
	}
	idx.Cardinality = append(idx.Cardinality, cardinality)
}
186583
func (ss stringSet) add(keys ...string) {
	for _, key := range keys {
		ss[key] = struct{}{}
	}
}
1160381
func (s *Set) Add(value interface{}) bool {
	// Check existence
	found := s.Has(value)

	// Lock set for write
	s.mutex.Lock()
	defer s.mutex.Unlock()

	// Add value to set
	s.m[value] = struct{}{}

	// Return inverse, so true if element already existed
	return !found
}
1230821
func (a Annotation) Add(key, value string) Annotation {
	a.setVal(key, value)
	return a
}
632905
func (b *InnerJSONBuilder) Add(infos ...*InnerPropertyInfo) *InnerJSONBuilder {
	for _, info := range infos {
		b._properties[info.fieldName] = info
	}
	return b
}
540064
func (b *SampleJSONBuilder) Add(info *SamplePropertyInfo) *SampleJSONBuilder {
	b._properties[info.fieldName] = info
	return b
}
1010519
func (lru *Lru) Add(k, v interface{}, size int64) {
	lru.Delete(k)
	e := &element{key: k, val: v, size: size}
	el := lru.list.PushBack(e)
	lru.elements[k] = el
	lru.size += size
	for lru.size > lru.maxSize && lru.deleteLast() {
		// left empty intentionally
	}
}
1268976
func (b *BarJSONBuilder) Add(info *BarPropertyInfo) *BarJSONBuilder {
	b._properties[info.fieldName] = info
	return b
}
494463
func (b *Builder) Add(args ...string) error {
	for _, a := range args {
		if err := b.add(a); err != nil {
			return errwrap.Wrapf(fmt.Sprintf("invalid key/value pair %q: {{err}}", a), err)
		}
	}

	return nil
}
583035
func (s *Set) Add(v string) bool {
	if pos := sort.SearchStrings(s.items, v); pos < len(s.items) {
		if s.items[pos] == v {
			return false
		}

		s.items = append(s.items, "")
		copy(s.items[pos+1:], s.items[pos:])
		s.items[pos] = v
	} else {
		s.items = append(s.items, v)
	}
	return true
}