<commit_before>package main

import (
	"database/sql"
	"fmt"
	_ "github.com/mattn/go-sqlite3"
	"log"
	"time"
)

func WhoBatch(batch string) {
	_ := batch
}

func Who(char string, lvl int) {
	loc, err := time.LoadLocation("America/New_York")
	if err != nil {
		log.Fatal(err)
	}
	date := time.Now().In(loc)
	// debugging
	fmt.Printf("Time: %v\n", date)

	db, err := sql.Open("sqlite3", "toril.db")
	if err != nil {
		log.Fatal(err)
	}
	defer db.Close()

	// TODO: switch to update first, who on particular err
	// check if character exists in DB
	stmt, err := db.Prepare("SELECT account_name, char_name FROM chars WHERE LOWER(char_name) = LOWER(?)")
	if err != nil {
		log.Fatal(err)
	}
	defer stmt.Close()

	var acc string
	var name string
	err = stmt.QueryRow(char).Scan(&acc, &name)
	if err != nil { // change to if err == actual NoData err
		// if char doesn't exist, 'who char'
		fmt.Printf("who %s\n", char)<commit_msg>Bit more on who batch processing<commit_after>package main

import (
	"database/sql"
	"fmt"
	_ "github.com/mattn/go-sqlite3"
	"log"
	"time"
	"strings"
)

func WhoBatch(batch string) {
	who := strings.Split(batch, "|")
	// regex for who line :/
}

func Who(char string, lvl int) {
	loc, err := time.LoadLocation("America/New_York")
	if err != nil {
		log.Fatal(err)
	}
	date := time.Now().In(loc)
	// debugging
	fmt.Printf("Time: %v\n", date)

	db, err := sql.Open("sqlite3", "toril.db")
	if err != nil {
		log.Fatal(err)
	}
	defer db.Close()

	// TODO: switch to update first, who on particular err
	// check if character exists in DB
	stmt, err := db.Prepare("SELECT account_name, char_name FROM chars WHERE LOWER(char_name) = LOWER(?)")
	if err != nil {
		log.Fatal(err)
	}
	defer stmt.Close()

	var acc string
	var name string
	err = stmt.QueryRow(char).Scan(&acc, &name)
	if err != nil { // change to if err == actual NoData err
		// if char doesn't exist, 'who char'
		fmt.Printf("who %s\n", char)
{'fraction_non_alphanumeric': 0.16147455867082036, 'fraction_numerical': 0.0020768431983385254, 'mean_word_length': 3.5023364485981308, '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': '266924', 'n_tokens_mistral': 766, 'n_tokens_neox': 738, 'n_words': 208}