diff options
author | Adamansky Anton <adamansky@gmail.com> | 2013-07-15 21:26:06 -0700 |
---|---|---|
committer | Adamansky Anton <adamansky@gmail.com> | 2013-07-15 21:26:06 -0700 |
commit | b05188c1fa0ad43683ea10748a81afe97e2f09e2 (patch) | |
tree | d395db532af9e4f9941c15c28eed97b31b9a0bde /README.md | |
parent | b0c2dd45cbb560d833fdab9c795b8fc9e6b993f5 (diff) | |
download | ejdb-b05188c1fa0ad43683ea10748a81afe97e2f09e2.tar.gz ejdb-b05188c1fa0ad43683ea10748a81afe97e2f09e2.tar.bz2 ejdb-b05188c1fa0ad43683ea10748a81afe97e2f09e2.zip |
Update README.md
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 57 |
1 files changed, 0 insertions, 57 deletions
@@ -718,63 +718,6 @@ db:close() * **[Lua binding](https://github.com/Softmotions/ejdb/blob/master/luaejdb/README.md)** -EJDB Go binding -================================== - -One snippet intro ------------------------------------ - -~~~~~~ -package ejdbtutorial - -import ( - "fmt" - "github.com/mkilling/ejdb/goejdb" - "labix.org/v2/mgo/bson" - "os" -) - -func main() { - // Create a new database file and open it - jb, err := goejdb.Open("addressbook", JBOWRITER | JBOCREAT | JBOTRUNC) - if err != nil { - os.Exit(1) - } - // Get or create collection 'contacts' - coll, _ := jb.CreateColl("contacts", nil) - - // Insert one record: - // JSON: {'name' : 'Bruce', 'phone' : '333-222-333', 'age' : 58} - rec := map[string]interface{} {"name" : "Bruce", "phone" : "333-222-333", "age" : 58} - bsrec, _ := bson.Marshal(rec) - coll.SaveBson(bsrec) - fmt.Printf("\nSaved Bruce") - - // Now execute query - res, _ := coll.Find(`{"name" : {"$begin" : "Bru"}}`) // Name starts with 'Bru' string - fmt.Printf("\n\nRecords found: %d\n", len(res)) - - // Now print the result set records - for _, bs := range res { - var m map[string]interface{} - bson.Unmarshal(bs, &m) - fmt.Println(m) - } - - // Close database - jb.Close() -} -~~~~~~ - -You can save this code in `ejdbtutorial.go` And build: - - -```sh -go build ejdbtutorial.go -./ejdbtutorial -``` - - EJDB C Library ================================== |