<commit_before>/*=======================================*/
//	project: gospatial
//	author: <NAME>
//	email: <EMAIL>
//  requires: ogr2ogr
/*=======================================*/

package main

import (
	"flag"
	"gospatial/app"
	"os"
)

var (
	apikey   string
	database string
)

func init() {
	flag.StringVar(&database, "db", "bolt", "app database")
	flag.Parse()
}

func main() {

	// Initiate Database
	app.DB = app.Database{File: "./" + database + ".db"}
	app.DB.Init()

	os.Exit(0)

}
<commit_msg>migrate tool<commit_after>/*=======================================*/
//	project: gospatial
//	author: <NAME>
//	email: <EMAIL>
/*=======================================*/

package main

import (
	"flag"
	"fmt"
	"github.com/boltdb/bolt"
	"gospatial/app"
	"os"
)

var (
	option   string
	database string
)

func init() {
	flag.StringVar(&database, "db", "bolt", "app database")
	flag.StringVar(&option, "o", "dump", "dump or load database")
	flag.Parse()
}

func main() {

	// Open db
	db, err := bolt.Open("./"+database+".db", 0600, nil)
	if err != nil {
		app.Error.Fatal(err)
	}
	defer db.Close()

	if option == "dump" {
		app.Info.Println("Dumping database...")

		// Get all layers
		db.View(func(tx *bolt.Tx) error {
			// Assume bucket exists and has keys
			b := tx.Bucket([]byte("layers"))

			b.ForEach(func(k, v []byte) error {
				fmt.Printf("key=%s, value=%s\n", k, v)
				return nil
			})
			return nil
		})

		// apikey
		db.View(func(tx *bolt.Tx) error {
			// Assume bucket exists and has keys
			b := tx.Bucket([]byte("apikeys"))

			b.ForEach(func(k, v []byte) error {
				fmt.Printf("key=%s, value=%s\n", k, v)
				return nil
			})
			return nil
		})

	} else if option == "load" {
		app.Info.Println("Loading database...")
	} else {
		app.Error.Fatal("Unknown option:", option)
	}

	os.Exit(0)

}

{'fraction_non_alphanumeric': 0.26769061985737796, 'fraction_numerical': 0.0038398244651673065, 'mean_word_length': 3.332541567695962, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3621613', 'n_tokens_mistral': 747, 'n_tokens_neox': 673, 'n_words': 155}