Esempio n. 1
0
/**
 *	Set specified bin's value to an int64_t.
 *	as_record_set_int64(rec, "bin", 123);
 *	@param rec 	- the record containing the bin
 *	@param name 	- the name of the bin
 *	@param value - the value of the bin
 *	@return true on success, false on failure.
 */
bool as_record_set_int64(as_record * rec, const as_bin_name name, int64_t value) 
{
	as_bin * bin = as_record_bin_forupdate(rec, name);
	if ( !bin ) return false;
	as_bin_init_int64(bin, name, value);
	return true;
}
/**
 *	Add a AS_OPERATOR_INCR bin operation with (required) int64_t value.
 *
 *	@param ops			The `as_operations` to append the operation to.
 *	@param name 		The name of the bin to perform the operation on.
 *	@param value 		The value to be used in the operation.
 *
 *	@return true on success. Otherwise an error occurred.
 */
bool as_operations_add_incr(as_operations * ops, const as_bin_name name, int64_t value)
{
	as_binop * binop = as_binop_forappend(ops, AS_OPERATOR_INCR, name);
	if ( !binop ) return false;
	as_bin_init_int64(&binop->bin, name, value);
	return true;
}