Exemplo n.º 1
0
// SetComparator sets the comparator which define the order of keys in the table.
// Default: a comparator that uses lexicographic byte-wise ordering
func (opts *Options) SetComparator(value Comparator) {
	if nc, ok := value.(nativeComparator); ok {
		opts.ccmp = nc.c
	} else {
		idx := registerComperator(value)
		opts.ccmp = C.gorocksdb_comparator_create(C.uintptr_t(idx))
	}
	C.rocksdb_options_set_comparator(opts.c, opts.ccmp)
}
Exemplo n.º 2
0
// Comparator used to define the order of keys in the table.
// Default: a comparator that uses lexicographic byte-wise ordering
func (self *Options) SetComparator(value Comparator) {
	if nc, ok := value.(nativeComparator); ok {
		self.ccmp = nc.c
	} else {
		h := unsafe.Pointer(&value)
		self.cmp = &value
		self.ccmp = C.gorocksdb_comparator_create(h)
	}
	C.rocksdb_options_set_comparator(self.c, self.ccmp)
}
Exemplo n.º 3
0
// SetComparator sets the comparator to be used for all read and write
// operations.
//
// The comparator that created a database must be the same one (technically,
// one with the same name string) that is used to perform read and write
// operations.
//
// The default comparator is usually sufficient.
func (o *Options) SetComparator(cmp *C.rocksdb_comparator_t) {
	C.rocksdb_options_set_comparator(o.Opt, cmp)
}