Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

approve test case #293

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions examples/basic/main.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
package main

import "github.com/rosedblabs/rosedb/v2"
import (
"os"
"runtime"

"github.com/rosedblabs/rosedb/v2"
)

// this file shows how to use the basic operations of rosedb

func main() {

// specify the options
options := rosedb.DefaultOptions
options.DirPath = "/tmp/rosedb_basic"
sysType := runtime.GOOS
if sysType == "windows" {
options.DirPath = "C:\\rosedb_basic"
} else {
options.DirPath = "/tmp/rosedb_basic"
}

//remove data dir, for test, there's no need to keep any file or directory on disk
defer func() {
_ = os.RemoveAll(options.DirPath)
}()

// open a database
db, err := rosedb.Open(options)
Expand Down