Example #1
0
func (w *writer) DeltaCounters(cf string, row *Row) Writer {
	for _, col := range row.Columns {
		tm := w.addWriter(cf, row.Key)
		c := cassandra.NewCounterColumn()
		c.Name = col.Name
		Unmarshal(col.Value, LongType, &c.Value)
		cs := cassandra.NewColumnOrSuperColumn()
		cs.CounterColumn = c
		tm.ColumnOrSupercolumn = cs
	}
	w.usedCounters = true
	return w
}
Example #2
0
func (w *writer) InsertTtl(cf string, row *Row, ttl int) Writer {
	t := now()
	for _, col := range row.Columns {
		tm := w.addWriter(cf, row.Key)
		c := cassandra.NewColumn()
		c.Name = col.Name
		c.Value = col.Value
		if ttl > 0 {
			c.Ttl = thrift.Int32Ptr(int32(ttl))
		}
		if col.Timestamp != nil {
			c.Timestamp = col.Timestamp
		} else {
			c.Timestamp = &t
		}
		cs := cassandra.NewColumnOrSuperColumn()
		cs.Column = c
		tm.ColumnOrSupercolumn = cs
	}
	return w
}