From abc7760457e7dd2efddf7a32ebf22f5acc7bfd49 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 13 Nov 2023 22:01:22 +0100 Subject: [PATCH] Update README.md --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index 61d06c2..ae4310c 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,45 @@ userTable.Insert([]interface{}{"Anna", nil, "USA"}) g.Save() ``` +#### Full Example +```go + if fileExists("./Social") { + err := os.Remove("./Social") + if err != nil { + t.Fatalf("Error removing old test file") + return + } + } + gorage := CreateNewGorage("./Social", false, false) + userTable := gorage.CreateTable("User") + if userTable == nil { + return + } + userTable. + AddColumn("Name", STRING). + AddColumn("Handle", STRING). + AddColumn("Age", INT) + gorage.Save() + + userTable.Insert([]interface{}{"Emily", "@Emily", 20}) + userTable.Insert([]interface{}{"Emily", "@Emily_Backup", 20}) + userTable.Insert([]interface{}{"Carl", "@Carl", 23}) + + gorage.Save() + + userTable. + Where(":Handle == '@Emily'"). + Update(map[string]interface{}{ + "Name": "Emily MLG", + }) + + gorage.Save() + userTable.Where(":Handle == '@Emily_Backup' || :Name == 'Carl'").Delete() + gorage.Save() + + +``` + ## Eval Operations Eval currently supports && (AND), || (OR), !& (NAND), !| (NOR), == (EQUAL), != (NOT EQUAL), <, <=, >, >= and Braces ( ).