Skip to content

Commit

Permalink
approve test case for Windows (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyonzhi committed Nov 28, 2023
1 parent 1494aac commit 7d8c6c0
Showing 1 changed file with 18 additions and 2 deletions.
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

0 comments on commit 7d8c6c0

Please sign in to comment.