<commit_before>package columns

import (
	"fmt"
	"reflect"
	"strings"
	"sync"
)

type Columns struct {
	Names           []string
	SymbolizedNames []string
	keys            map[string]string
}

// NamesString is a comma separated list of the column names.
func (c *Columns) NamesString() string {
	return strings.Join(c.Names, ", ")
}

// SymbolizedNamesString returns a comma separated list of
// the column names with a colon in front of each name.
func (c *Columns) SymbolizedNamesString() string {
	return strings.Join(c.SymbolizedNames, ", ")
}

// UpdatesString returns a comma separated list key = :value
// pairs, used for building named `UPDATE` statements.
func (c *Columns) UpdatesString() string {
	sets := []string{}
	for i := 0; i < len(c.Names); i++ {
		sets = append(sets, fmt.Sprintf("%s = %s", c.Names[i], c.SymbolizedNames[i]))
	}
	return strings.Join(sets, ", ")
}

// Add a column to the list.
func (c *Columns) Add(name string) {
	if c.keys[name] == "" {
		c.Names = append(c.Names, name)
		c.SymbolizedNames = append(c.SymbolizedNames, fmt.Sprintf(":%s", name))
		c.keys[name] = name
	}<commit_msg>Columns.Add can now take multiple names at once.<commit_after>package columns

import (
	"fmt"
	"reflect"
	"strings"
	"sync"
)

type Columns struct {
	Names           []string
	SymbolizedNames []string
	keys            map[string]string
}

// NamesString is a comma separated list of the column names.
func (c *Columns) NamesString() string {
	return strings.Join(c.Names, ", ")
}

// SymbolizedNamesString returns a comma separated list of
// the column names with a colon in front of each name.
func (c *Columns) SymbolizedNamesString() string {
	return strings.Join(c.SymbolizedNames, ", ")
}

// UpdatesString returns a comma separated list key = :value
// pairs, used for building named `UPDATE` statements.
func (c *Columns) UpdatesString() string {
	sets := []string{}
	for i := 0; i < len(c.Names); i++ {
		sets = append(sets, fmt.Sprintf("%s = %s", c.Names[i], c.SymbolizedNames[i]))
	}
	return strings.Join(sets, ", ")
}

// Add a column to the list.
func (c *Columns) Add(names ...string) {
	for _, name := range names {
		if c.keys[name] == "" {
			c.Names = append(c.Names, name)
			c.SymbolizedNames = append(c.SymbolizedNames, fmt.Sprintf(":%s", name))
			c.keys[name] = name
		}
	}
{'fraction_non_alphanumeric': 0.14501510574018128, 'fraction_numerical': 0.0008631851532153647, 'mean_word_length': 3.6546184738955825, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4357040', 'n_tokens_mistral': 778, 'n_tokens_neox': 757, 'n_words': 243}