Skip to content

Basic Operations

roseduan edited this page May 8, 2022 · 3 revisions

Basic Operations

Basic operations for RoseDB.

Open a database

import (
   "fmt"
   "github.com/flower-corp/rosedb"
   "path/filepath"
)

func main() {
   path := filepath.Join("/tmp", "rosedb")
   opts := rosedb.DefaultOptions(path)
   db, err := rosedb.Open(opts)
   if err != nil {
      fmt.Printf("open rosedb err: %v", err)
      return
   }
   defer db.Close()
}

You must specify a file path to open rosedb.

And you can set other options by otps.XXX.

Clone this wiki locally