Skip to content

Commit

Permalink
- Made factory functions that accept native pointers accept unsafe po…
Browse files Browse the repository at this point in the history
…inter instead of the typed versions due to golang/go#13467
  • Loading branch information
02p01r committed Apr 20, 2020
1 parent c63f8b6 commit bfd0b34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cf_handle.go
Expand Up @@ -15,6 +15,10 @@ func NewNativeColumnFamilyHandle(c *C.rocksdb_column_family_handle_t) *ColumnFam
return &ColumnFamilyHandle{c}
}

func NewNativeColumnFamilyHandle1(c unsafe.Pointer) *ColumnFamilyHandle {
return NewNativeColumnFamilyHandle((*C.rocksdb_column_family_handle_t)(c))
}

// UnsafeGetCFHandler returns the underlying c column family handle.
func (h *ColumnFamilyHandle) UnsafeGetCFHandler() unsafe.Pointer {
return unsafe.Pointer(h.c)
Expand Down
4 changes: 2 additions & 2 deletions db.go
Expand Up @@ -22,8 +22,8 @@ type DB struct {
name string
}

func NewDBFromNative(db_native *C.rocksdb_t, name_optional string) *DB {
return &DB{c: db_native, name: name_optional}
func NewDBFromNative(db_native unsafe.Pointer) *DB {
return &DB{c: (*C.rocksdb_t)(db_native)}
}

// OpenDb opens a database with the specified options.
Expand Down

0 comments on commit bfd0b34

Please sign in to comment.