github.com/flower-corp/rosedb@v1.1.2-0.20230117132829-21dc4f7b319a/examples/open/open_db.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/flower-corp/rosedb"
     6  	"path/filepath"
     7  )
     8  
     9  func main() {
    10  	path := filepath.Join("/tmp", "rosedb")
    11  	// specify other options
    12  	// opts.XXX
    13  	opts := rosedb.DefaultOptions(path)
    14  	db, err := rosedb.Open(opts)
    15  	if err != nil {
    16  		fmt.Printf("open rosedb err: %v", err)
    17  		return
    18  	}
    19  	defer func() {
    20  		_ = db.Close()
    21  	}()
    22  }