nunc 0.2.0

WIP: time tracking application
Documentation
use liter::{
	database,
	Table,
	Id
};


#[database]
pub struct Cache (
	StreakDamage,
	StreakSegment,
	StreakIteration,
	ActivityAffects
);

#[derive(Table, PartialEq, Eq, Debug)]
pub struct StreakIteration {
	#[key]
	pub streak_id: u64,
	#[key]
	pub number: u64,
	pub value: u64
}


#[derive(Table, PartialEq, Eq, Debug)]
pub struct StreakSegment {
	#[key]
	pub id: Id,
	pub definition_id: u64,
	/// The first (fulfilled) iteration in the segment
	pub start: u64,
	/// The last (fulfilled) iteration in the segment (inclusive)
	pub stop: u64
}


#[derive(Table, PartialEq, Eq, Debug)]
pub struct StreakDamage {
	#[key]
	pub streak_id: u64,
	pub damage: i64
}

#[derive(Table, PartialEq, Eq, Debug)]
pub struct ActivityAffects {
	#[key]
	pub activity_id: u64,
	#[key]
	pub streak_id: u64
}


impl StreakSegment {
	pub fn length(&self) -> u64 {
		debug_assert!(self.stop >= self.start);
		self.stop - self.start + 1
	}
}