<commit_before>package main

import (
	"encoding/json"
	"log"
	"net/http"

	rdb "github.com/dancannon/gorethink"
	"github.com/julienschmidt/httprouter"
	"github.com/rs/cors"
)

// Person is the model for our user
type Person struct {
	ID             string `gorethink:"id,omitempty"` // Need json
	FirstName      string `json:"firstName"`
	LastName       string `json:"lastName"`
	CoolnessFactor int    `json:"coolnessFactor"`
}

// DB holds our connection to the database
type DB struct {
	Session *rdb.Session
}

func newDBConn() *DB {
	session, err := rdb.Connect(rdb.ConnectOpts{
		Address: "localhost:28015",
	})
	if err != nil {
		log.Fatal("Error: %s\n", err)
	}
	return &DB{
		Session: session,
	}
}


// InitTable creates a new table
func (db *DB) InitTable(tableName string) {
	resp, err := rdb.TableCreate(tableName).RunWrite(db.Session)
	if err != nil {
		log.Printf("Note: %s\n", err)
	}
	log.Println("Tables created: ", resp.TablesCreated)
}

// List all users
func (db *DB) List(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
	var people []Person
	rows, err := rdb.Table("People").Run(db.Session)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
<commit_msg>Fix json and gorethink struct defs<commit_after>package main

import (
	"encoding/json"
	"log"
	"net/http"

	rdb "github.com/dancannon/gorethink"
	"github.com/julienschmidt/httprouter"
	"github.com/rs/cors"
)

// Person is the model for our user.
type Person struct {
	ID             string `json:"id" gorethink:"id,omitempty"`
	FirstName      string `json:"firstName"`
	LastName       string `json:"lastName"`
	CoolnessFactor int    `json:"coolnessFactor"`
}

// DB stores our connection to the database.
type DB struct {
	Session *rdb.Session
}

func newDBConn() *DB {
	session, err := rdb.Connect(rdb.ConnectOpts{
		Address: "localhost:28015",
	})
	if err != nil {
		log.Fatal("Error: %s\n", err)
	}
	return &DB{
		Session: session,
	}
}

// InitTable creates a new table.
func (db *DB) InitTable(tableName string) {
	resp, err := rdb.TableCreate(tableName).RunWrite(db.Session)
	if err != nil {
		log.Printf("Note: %s\n", err)
	}
	log.Println("Tables created: ", resp.TablesCreated)
}

// List all users
func (db *DB) List(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
	var people []Person
	rows, err := rdb.Table("People").Run(db.Session)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}

{'fraction_non_alphanumeric': 0.14697523345513602, 'fraction_numerical': 0.004060089321965083, 'mean_word_length': 3.8503937007874014, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2023334', 'n_tokens_mistral': 910, 'n_tokens_neox': 892, 'n_words': 222}