func (t *Table) AddBindings(bs []string) {
	t.mu.Lock()
	t.unsafeAddBindings(bs)
	t.mu.Unlock()
}
AddBindings add the new bindings provided to the table.
package table
import (
	"bytes"
	"errors"
	"fmt"
	"io"
	"log"
	"reflect"
	"sort"
	"strings"
	"sync"
	"time"
	"github.com/google/badwolf/triple/literal"
	"github.com/google/badwolf/triple/node"
	"github.com/google/badwolf/triple/predicate"
)
type Table struct {
	AvailableBindings []string `json:"bindings,omitempty"`
	Data []Row `json:"rows,omitempty"`
	mbs map[string]bool
	mu sync.RWMutex
}
func New(bs []string) (*Table, error) {
	m := make(map[string]bool)
	for _, b := range bs {
		m[b] = true
	}
	if len(m) != len(bs) {
		return nil, fmt.Errorf("table.New does not allow duplicated bindings in %s", bs)
	}
	return &Table{
		AvailableBindings: bs,
		mbs:               m,
	}, nil
}
type Cell struct {
	S *string              `json:"s,omitempty"`
	N *node.Node           `json:"node,omitempty"`
	P *predicate.Predicate `json:"pred,omitempty"`
	L *literal.Literal     `json:"lit,omitempty"`
	T *time.Time           `json:"time,omitempty"`
}
func (c *Cell) String() string {
	if c.S != nil {
		return *c.S
	}
	if c.N != nil {
		return c.N.String()
	}
	if c.P != nil {
		return c.P.String()
	}
	if c.L != nil {
		return c.L.String()
	}
	if c.T != nil {
		return c.T.Format(time.RFC3339Nano)
	}
	return "<NULL>"
}
type Row map[string]*Cell
func (r Row) ToTextLine(res *bytes.Buffer, bs []string, sep string) error {
	cnt := len(bs)
	if sep == "" {
		sep = "\t"
	}
	for _, b := range bs {
		cnt--
		v := "<NULL>"
		if c, ok := r[b]; ok {
			v = c.String()
		}
		if _, err := res.WriteString(v); err != nil {
			return err
		}
		if cnt > 0 {
			res.WriteString(sep)
		}
	}
	return nil
}
func (t *Table) AddRow(r Row) {
	t.mu.Lock()
	if len(r) > 0 {
		delete(r, "")
		t.Data = append(t.Data, r)
	}
	t.mu.Unlock()
}
func (t *Table) NumRows() int {
	t.mu.RLock()
	defer t.mu.RUnlock()
	return len(t.Data)
}
func (t *Table) Row(i int) (Row, bool) {
	t.mu.RLock()
	defer t.mu.RUnlock()
	if i < 0 || i >= len(t.Data) {
		return nil, false
	}
	return t.Data[i], true
}
func (t *Table) Rows() []Row {
	t.mu.RLock()
	defer t.mu.RUnlock()
	return t.Data
}
func (t *Table) unsafeAddBindings(bs []string) {
	for _, b := range bs {
		if !t.mbs[b] {
			t.mbs[b] = true
			t.AvailableBindings = append(t.AvailableBindings, b)
		}
	}
}