<commit_before>package sqldb

import (
	"bytes"
	"database/sql"
	"fmt"
	"strings"
)

type ColumnNames []string

type ColumnNameJoinRule interface {
	Separator() string
	Append(buffer *bytes.Buffer, c string)
}

type columnNameJoinAsList struct{}

var _ ColumnNameJoinRule = columnNameJoinAsList{}

func (columnNameJoinAsList) Separator() string { return ", " }

func (columnNameJoinAsList) Append(buffer *bytes.Buffer, c string) {
	buffer.WriteString(c)
}

type columnNameJoinAsNamedList struct{}

var _ ColumnNameJoinRule = columnNameJoinAsNamedList{}

func (columnNameJoinAsNamedList) Separator() string { return ", " }

func (columnNameJoinAsNamedList) Append(buffer *bytes.Buffer, c string) {
	buffer.WriteString(":")
	buffer.WriteString(c)
}

type columnNameJoinAsUpdate struct{}

var _ ColumnNameJoinRule = columnNameJoinAsUpdate{}

func (columnNameJoinAsUpdate) Separator() string { return ", " }

func (columnNameJoinAsUpdate) Append(buffer *bytes.Buffer, c string) {
	buffer.WriteString(c)
	buffer.WriteString(" = ?")
}

type columnNameJoinAsNamedUpdate struct{}

var _ ColumnNameJoinRule = columnNameJoinAsNamedUpdate{}

func (columnNameJoinAsNamedUpdate) Separator() string { return ", " }

func (columnNameJoinAsNamedUpdate) Append(buffer *bytes.Buffer, c string) {
	buffer.WriteString(c)
	buffer.WriteString(" = :")
	buffer.WriteString(c)
}

type columnNameJoinAsCond struct{ Cond string }

var _ ColumnNameJoinRule = columnNameJoinAsCond{}

func (c columnNameJoinAsCond) Separator() string { return " " + c.Cond + " " }

func (columnNameJoinAsCond) Append(buffer *bytes.Buffer, c string) {
	buffer.WriteString(c)
	buffer.WriteString(" = ?")
}

type columnNameJoinAsNamedCond struct{ Cond string }

var _ ColumnNameJoinRule = columnNameJoinAsNamedCond{}

func (c columnNameJoinAsNamedCond) Separator() string { return " " + c.Cond + " " }

func (columnNameJoinAsNamedCond) Append(buffer *bytes.Buffer, c string) {
	buffer.WriteString(c)
	buffer.WriteString(" = :")
	buffer.WriteString(c)
}

func (c ColumnNames) Join(rule ColumnNameJoinRule) string {
	var b bytes.Buffer
	for _, c := range c {
		if b.Len() > 0 {
			b.WriteString(rule.Separator())
		}
		rule.Append(&b, c)
	}
	return b.String()
}

func (c ColumnNames) List() string {
	return c.Join(columnNameJoinAsList{})
}

func (c ColumnNames) NamedList() string {
	return c.Join(columnNameJoinAsNamedList{})
}

func (c ColumnNames) Update() string {
	return c.Join(columnNameJoinAsUpdate{})
}

func (c ColumnNames) NamedUpdate() string {
	return c.Join(columnNameJoinAsNamedUpdate{})
}

func (c ColumnNames) Cond(cond string) string {
	return c.Join(columnNameJoinAsCond{})
}

func (c ColumnNames) NamedCond(cond string) string {
	return c.Join(columnNameJoinAsNamedCond{})
}

func (c ColumnNames) Contains(col string) bool {
	for _, s := range c {
		if s == col {
			return true
		}
	}
	return false
}

func (c ColumnNames) Copy() ColumnNames {
	nc := make(ColumnNames, len(c))
	copy(nc, c)<commit_msg>fixed columns join with cond<commit_after>package sqldb

import (
	"bytes"
	"database/sql"
	"fmt"
	"strings"
)

type ColumnNames []string

type ColumnNameJoinRule interface {
	Separator() string
	Append(buffer *bytes.Buffer, c string)
}

type columnNameJoinAsList struct{}

var _ ColumnNameJoinRule = columnNameJoinAsList{}

func (columnNameJoinAsList) Separator() string { return ", " }

func (columnNameJoinAsList) Append(buffer *bytes.Buffer, c string) {
	buffer.WriteString(c)
}

type columnNameJoinAsNamedList struct{}

var _ ColumnNameJoinRule = columnNameJoinAsNamedList{}

func (columnNameJoinAsNamedList) Separator() string { return ", " }

func (columnNameJoinAsNamedList) Append(buffer *bytes.Buffer, c string) {
	buffer.WriteString(":")
	buffer.WriteString(c)
}

type columnNameJoinAsUpdate struct{}

var _ ColumnNameJoinRule = columnNameJoinAsUpdate{}

func (columnNameJoinAsUpdate) Separator() string { return ", " }

func (columnNameJoinAsUpdate) Append(buffer *bytes.Buffer, c string) {
	buffer.WriteString(c)
	buffer.WriteString(" = ?")
}

type columnNameJoinAsNamedUpdate struct{}

var _ ColumnNameJoinRule = columnNameJoinAsNamedUpdate{}

func (columnNameJoinAsNamedUpdate) Separator() string { return ", " }

func (columnNameJoinAsNamedUpdate) Append(buffer *bytes.Buffer, c string) {
	buffer.WriteString(c)
	buffer.WriteString(" = :")
	buffer.WriteString(c)
}

type columnNameJoinAsCond struct {
	Cond  string
	Check string
}

var _ ColumnNameJoinRule = columnNameJoinAsCond{}

func (cd columnNameJoinAsCond) Separator() string { return " " + cd.Cond + " " }

func (cd columnNameJoinAsCond) Append(buffer *bytes.Buffer, c string) {
	buffer.WriteString(c)
	buffer.WriteString(" " + cd.Check + " ?")
}

type columnNameJoinAsNamedCond struct {
	Cond  string
	Check string
}

var _ ColumnNameJoinRule = columnNameJoinAsNamedCond{}

func (cd columnNameJoinAsNamedCond) Separator() string { return " " + cd.Cond + " " }

func (cd columnNameJoinAsNamedCond) Append(buffer *bytes.Buffer, c string) {
	buffer.WriteString(c)
	buffer.WriteString(" " + cd.Check + " :")
	buffer.WriteString(c)
}

func (c ColumnNames) Join(rule ColumnNameJoinRule) string {
	var b bytes.Buffer
	for _, c := range c {
		if b.Len() > 0 {
			b.WriteString(rule.Separator())
		}
		rule.Append(&b, c)
	}
	return b.String()
}

func (c ColumnNames) List() string {
	return c.Join(columnNameJoinAsList{})
}

func (c ColumnNames) NamedList() string {
	return c.Join(columnNameJoinAsNamedList{})
}

func (c ColumnNames) Update() string {
	return c.Join(columnNameJoinAsUpdate{})
}

func (c ColumnNames) NamedUpdate() string {
	return c.Join(columnNameJoinAsNamedUpdate{})
}

func (c ColumnNames) Cond(cond, check string) string {
	return c.Join(columnNameJoinAsCond{Cond: cond, Check: check})
}

func (c ColumnNames) NamedCond(cond, check string) string {
	return c.Join(columnNameJoinAsNamedCond{Cond: cond, Check: check})
}

func (c ColumnNames) Contains(col string) bool {
	for _, s := range c {
		if s == col {
			return true
		}
	}
	return false
}

func (c ColumnNames) Copy() ColumnNames {
	nc := make(ColumnNames, len(c))
	copy(nc, c)
{'fraction_non_alphanumeric': 0.11980961759396028, 'fraction_numerical': 0.0003282455276546857, 'mean_word_length': 5.421496311907271, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, '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': '7263549', 'n_tokens_mistral': 2035, 'n_tokens_neox': 2037, 'n_words': 487}