Esempio n. 1
0
func (w *writer) DeleteColumns(cf string, key []byte, columns [][]byte) Writer {
	tm := w.addWriter(cf, key)
	d := cassandra.NewDeletion()
	ts := now()
	d.Timestamp = &ts
	sp := cassandra.NewSlicePredicate()
	colNamesArr := make([][]byte, len(columns))
	for i, name := range columns {
		colNamesArr[i] = name
	}
	sp.ColumnNames = &colNamesArr
	d.Predicate = sp
	tm.Deletion = d
	return w
}
Esempio n. 2
0
func (r *reader) buildPredicate() *cassandra.SlicePredicate {
	sp := cassandra.NewSlicePredicate()
	if r.setColumns {
		colArr := make([][]byte, 0)
		for _, col := range r.columns {
			colArr = append(colArr, col)
		}
		sp.ColumnNames = &colArr
	} else if r.setSlice {
		sp.SliceRange = sliceToCassandra(&r.slice)
	} else {
		sp.SliceRange = fullSlice()
	}
	return sp
}