Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A cool way to work with bolt database buckets

License

NotificationsYou must be signed in to change notification settings

gernest/nutz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nutz is a library for interacting with bolt databases. It removes the boilerplates andstay faithful with the bolt database view of "simple API".

Where is nutz useful

  • You want to maintain more than one database
  • Your project uses nested buckets extensively.

Installation

go get github.com/gernest/nutz

How to use

package mainimport ("fmt""github.com/gernest/nutz")funcmain() {databaseName:="my-databse.db"// ntz.NewStorage takes the same arguments as *bolt.Open. The differnce is with// nutz nothing is opened.db:=nutz.NewStorage(databaseName,0600,nil)// Creates a new record in the bucket library with key  "lady morgana" and// value []byte("A mist of avalon")db.Create("library","lady morgana", []byte("A mist of avalon"))// If you want to create a record which will be deep inside buckets. lets say// you want to store a record for a teacher. The buckets will be like// city>school>class>teacher.db.Create("city","john Doe", []byte("scientist"),"school","class","teacher")// Retrieving records from a bolt database.d:=db.Get("library","lady morgana")fmt.Println(string(d.Data)=="A mist of avalon")//=> true// lets check if there was any errorfmt.Println(d.Error)//=> nil// Retriving nested buckets .n:=db.Get("city","john Doe","school","class","teacher")fmt.Println(string(n.Data)=="scientist")//=> true// Lets delete the databasedb.DeleteDatabase()}

Contributing

Start with clicking the star button to make the author and his neighbors happy. Then fork it and submit a pull request for whatever change you want to be added to this project.

Or, open an issue for any questions.

Author

Geofrey Ernestgeofreyernest@live.com

Twitter :@gernesti

License

This project is under the MIT License. See theLICENSE file for the full license text.

About

A cool way to work with bolt database buckets

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp