// Add checks that the ColInfo is valid and that the name is unique and then
// adds the new column. It returns nil if there were no problems or a
// descriptive error otherwise.
Add checks that the ColInfo is valid and that the name is unique and then
adds the new column. It returns nil if there were no problems or a
descriptive error otherwise.
// Add checks that the ColInfo is valid and that the name is unique and then // adds the new column . It returns nil if there were no problems or a // descriptive error otherwise .
func (mci *MultiColInfo) Add(ci ColInfo) error {
	err := ci.Check()
	if err != nil {
		return err
	}
	if otherIdx, exists := mci.nameToCol[ci.name]; exists {
		return dfErrorf("Column name already used: %s", mci.ColDesc(otherIdx))
	}
	count := 0
	for _, existingCi := range mci.info {
		if ci.colType == existingCi.colType {
			count++
		}
	}
	mci.valIdx = append(mci.valIdx, count)
	mci.nameToCol[ci.name] = len(mci.info)
	mci.info = append(mci.info, ci)
	return nil
}
func ( mci * MultiColInfo ) Add ( ci ColInfo ) error { err := ci . Check ( ) if err != nil { return err } if otherIdx , exists := mci . nameToCol [ ci . name ] ; exists { return dfErrorf ( " " , mci . ColDesc ( otherIdx ) ) } count := 0 for _ , existingCi := range mci . info { if ci . colType == existingCi . colType { count ++ } } mci . valIdx = append ( mci . valIdx , count ) mci . nameToCol [ ci . name ] = len ( mci . info ) mci . info = append ( mci . info , ci ) return nil }
Add checks that the ColInfo is valid and that the name is unique and then
adds the new column.
Add checks that the ColInfo is valid and that the name is unique and then adds the new column .