Пример #1
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 {
			ttlTmp := int32(ttl)
			c.Ttl = &ttlTmp
		} else {
			if col.Ttl > 0 {
				c.Ttl = &col.Ttl
			}
		}
		if col.Timestamp > 0 {
			c.Timestamp = &col.Timestamp
		} else {
			c.Timestamp = &t
		}
		cs := cassandra.NewColumnOrSuperColumn()
		cs.Column = c
		tm.ColumnOrSupercolumn = cs
	}
	return w
}
Пример #2
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
}