func OpenOptimisticTransactionDbColumnFamilies(
	opts *Options,
	name string,
	cfNames []string,
	cfOpts []*Options,
) (*OptimisticTransactionDB, []*ColumnFamilyHandle, error) {
	numColumnFamilies := len(cfNames)
	if numColumnFamilies != len(cfOpts) {
		return nil, nil, errors.New("must provide the same number of column family names and options")
	}

	var (
		cErr  *C.char
		cName = C.CString(name)
	)
	defer C.free(unsafe.Pointer(cName))

	cNames := make([]*C.char, numColumnFamilies)
	for i, s := range cfNames {
		cNames[i] = C.CString(s)
	}
	defer func() {
		for _, s := range cNames {
			C.free(unsafe.Pointer(s))
		}
	}()

	cOpts := make([]*C.rocksdb_options_t, numColumnFamilies)
	for i, o := range cfOpts {
		cOpts[i] = o.c
	}

	cHandles := make([]*C.rocksdb_column_family_handle_t, numColumnFamilies)

	db := C.rocksdb_optimistictransactiondb_open_column_families(
		opts.c,
		cName,
		C.int(numColumnFamilies),
		&cNames[0],
		&cOpts[0],
		&cHandles[0],
		&cErr)
	if cErr != nil {
		defer C.free(unsafe.Pointer(cErr))
		return nil, nil, errors.New(C.GoString(cErr))
	}

	cfHandles := make([]*ColumnFamilyHandle, numColumnFamilies)
	for i, c := range cHandles {
		cfHandles[i] = NewNativeColumnFamilyHandle(c)
	}

	baseDB := C.rocksdb_optimistictransactiondb_get_base_db(db)

	return &OptimisticTransactionDB{
		baseDB: &DB{
			name: name,
			c:    baseDB,
			opts: opts,
		},
		name: name,
		c:    db,
		opts: opts,
	}, cfHandles, nil
}
// OpenOptimisticTransactionDb opens a database with the specified options.
OpenOptimisticTransactionDb opens a database with the specified options.
// OpenOptimisticTransactionDb opens a database with the specified options .
func OpenOptimisticTransactionDbColumnFamilies(
	opts *Options,
	name string,
	cfNames []string,
	cfOpts []*Options,
) (*OptimisticTransactionDB, []*ColumnFamilyHandle, error) {
	numColumnFamilies := len(cfNames)
	if numColumnFamilies != len(cfOpts) {
		return nil, nil, errors.New("must provide the same number of column family names and options")
	}
	var (
		cErr  *C.char
		cName = C.CString(name)
	)
	defer C.free(unsafe.Pointer(cName))
	cNames := make([]*C.char, numColumnFamilies)
	for i, s := range cfNames {
		cNames[i] = C.CString(s)
	}
	defer func() {
		for _, s := range cNames {
			C.free(unsafe.Pointer(s))
		}
	}()
	cOpts := make([]*C.rocksdb_options_t, numColumnFamilies)
	for i, o := range cfOpts {
		cOpts[i] = o.c
	}
	cHandles := make([]*C.rocksdb_column_family_handle_t, numColumnFamilies)
	db := C.rocksdb_optimistictransactiondb_open_column_families(
		opts.c,
		cName,
		C.int(numColumnFamilies),
		&cNames[0],
		&cOpts[0],
		&cHandles[0],
		&cErr)
	if cErr != nil {
		defer C.free(unsafe.Pointer(cErr))
		return nil, nil, errors.New(C.GoString(cErr))
	}
	cfHandles := make([]*ColumnFamilyHandle, numColumnFamilies)
	for i, c := range cHandles {
		cfHandles[i] = NewNativeColumnFamilyHandle(c)
	}
	baseDB := C.rocksdb_optimistictransactiondb_get_base_db(db)
	return &OptimisticTransactionDB{
		baseDB: &DB{
			name: name,
			c:    baseDB,
			opts: opts,
		},
		name: name,
		c:    db,
		opts: opts,
	}, cfHandles, nil
}
func OpenOptimisticTransactionDbColumnFamilies ( opts * Options , name string , cfNames [ ] string , cfOpts [ ] * Options , ) ( * OptimisticTransactionDB , [ ] * ColumnFamilyHandle , error ) { numColumnFamilies := len ( cfNames ) if numColumnFamilies != len ( cfOpts ) { return nil , nil , errors . New ( " " ) } var ( cErr * C . char cName = C . CString ( name ) ) defer C . free ( unsafe . Pointer ( cName ) ) cNames := make ( [ ] * C . char , numColumnFamilies ) for i , s := range cfNames { cNames [ i ] = C . CString ( s ) } defer func ( ) { for _ , s := range cNames { C . free ( unsafe . Pointer ( s ) ) } } ( ) cOpts := make ( [ ] * C . rocksdb_options_t , numColumnFamilies ) for i , o := range cfOpts { cOpts [ i ] = o . c } cHandles := make ( [ ] * C . rocksdb_column_family_handle_t , numColumnFamilies ) db := C . rocksdb_optimistictransactiondb_open_column_families ( opts . c , cName , C . int ( numColumnFamilies ) , & cNames [ 0 ] , & cOpts [ 0 ] , & cHandles [ 0 ] , & cErr ) if cErr != nil { defer C . free ( unsafe . Pointer ( cErr ) ) return nil , nil , errors . New ( C . GoString ( cErr ) ) } cfHandles := make ( [ ] * ColumnFamilyHandle , numColumnFamilies ) for i , c := range cHandles { cfHandles [ i ] = NewNativeColumnFamilyHandle ( c ) } baseDB := C . rocksdb_optimistictransactiondb_get_base_db ( db ) return & OptimisticTransactionDB { baseDB : & DB { name : name , c : baseDB , opts : opts , } , name : name , c : db , opts : opts , } , cfHandles , nil }
OpenOptimisticTransactionDb opens a database with the specified options.
OpenOptimisticTransactionDb opens a database with the specified options .