diff --git a/benchmark.go b/benchmark.go index 95378e9..7e48290 100644 --- a/benchmark.go +++ b/benchmark.go @@ -16,7 +16,7 @@ func TestBenchmark(t *testing.T) { return } } - gorage := CreateNewGorage("./benchmark", false, false) + gorage := Create("./benchmark", false, false) randomTable := gorage.CreateTable("Random") if randomTable == nil { t.Fatalf("Table was not created") @@ -55,7 +55,7 @@ func TestBenchmark(t *testing.T) { t1 = time.Now().Unix() gorage.Save() - gorage = OpenGorage("./benchmark") + gorage = Open("./benchmark") t.Log(fmt.Sprintf("Saving and loading took %ds", time.Now().Unix()-t1)) t1 = time.Now().Unix() diff --git a/gorage.go b/gorage.go index 2e6aae8..5130d35 100644 --- a/gorage.go +++ b/gorage.go @@ -96,7 +96,7 @@ func (g *Gorage) Save() { /* Open a gorage from a path */ -func OpenGorage(path string) *Gorage { +func Open(path string) *Gorage { f, err := os.Open(path) if err != nil { panic(err.Error()) @@ -130,7 +130,7 @@ allowDuplicates: If a table can contain multiple identical datasets log: If you want to get spammed :^) */ -func CreateNewGorage(path string, allowDuplicates, log bool) *Gorage { +func Create(path string, allowDuplicates, log bool) *Gorage { if !fileExists(path) { f, err := os.Create(path) if err != nil { @@ -152,5 +152,5 @@ func CreateNewGorage(path string, allowDuplicates, log bool) *Gorage { panic(err.Error()) } } - return OpenGorage(path) + return Open(path) } diff --git a/gorage_concurrency_test.go b/gorage_concurrency_test.go index 1315227..4212658 100644 --- a/gorage_concurrency_test.go +++ b/gorage_concurrency_test.go @@ -15,7 +15,7 @@ func TestConcurrency(t *testing.T) { return } } - g := CreateNewGorage("./concurrent", false, false) + g := Create("./concurrent", false, false) //CreateTable should not be used concurrent UNLESS it is waited on properly. //But it still can fail in concurrent usage. NOT RECOMMENDED var group sync.WaitGroup diff --git a/gorage_test.go b/gorage_test.go index 233e229..ac1d22c 100644 --- a/gorage_test.go +++ b/gorage_test.go @@ -14,7 +14,7 @@ func TestCreateFile(t *testing.T) { return } } - CreateNewGorage("./test", false, false) + Create("./test", false, false) _, err := os.Stat("./test") if os.IsNotExist(err) { t.Fatalf("File was not created") @@ -22,7 +22,7 @@ func TestCreateFile(t *testing.T) { } func TestCreateTable(t *testing.T) { - g := OpenGorage("./test") + g := Open("./test") table := g.CreateTable("User") if table != nil { table.AddColumn("FirstName", STRING). @@ -36,7 +36,7 @@ func TestCreateTable(t *testing.T) { } func TestInsert(t *testing.T) { - g := OpenGorage("./test") + g := Open("./test") userTable := g.FromTable("User") userTable.Insert([]interface{}{"James", "aa", 2, 85.5}) userTable.Insert([]interface{}{"Carl", "aa", 3, 90.5}) @@ -50,7 +50,7 @@ func TestInsert(t *testing.T) { } func TestUpdate(t *testing.T) { - g := OpenGorage("./test") + g := Open("./test") g.FromTable("User"). Where(":FirstName == 'James'"). Update(map[string]interface{}{ @@ -66,7 +66,7 @@ func TestUpdate(t *testing.T) { } func TestWhere(t *testing.T) { - g := OpenGorage("./test") + g := Open("./test") userTable := g. FromTable("User"). Where("( :FirstName == 'William' && :Age == 2 ) || :IQ >= 90.0"). @@ -96,7 +96,7 @@ func TestWhere(t *testing.T) { } func TestDelete(t *testing.T) { - g := OpenGorage("./test") + g := Open("./test") g. FromTable("User"). Where(":FirstName == 'Carl'"). @@ -111,13 +111,13 @@ func TestDelete(t *testing.T) { } func TestAddColumn(t *testing.T) { - g := OpenGorage("./test") + g := Open("./test") g.FromTable("User").AddColumn("Lol", INT) g.Save() } func TestRemoveColumn(t *testing.T) { - g := OpenGorage("./test") + g := Open("./test") table := g.FromTable("User") l := len(table.Columns) table.RemoveColumn("IQ") @@ -135,7 +135,7 @@ func TestComplete(t *testing.T) { return } } - gorage := CreateNewGorage("./Social", false, false) + gorage := Create("./Social", false, false) userTable := gorage.CreateTable("User") if userTable == nil { return