package models import "time" // BeginningOfDay provides functionality. func BeginningOfDay(t time.Time) time.Time { year, month, day := t.Date() return time.Date(year, month, day, 0, 0, 0, 0, t.Location()) } // SetBit provides functionality. // https://stackoverflow.com/questions/23192262/how-would-you-set-and-clear-a-single-bit-in-go // Sets the bit at pos in the integer n. func SetBit(n int, pos uint) int { n |= (1 << pos) return n } // ClearBit provides functionality. // Clears the bit at pos in n. func ClearBit(n int, pos uint) int { mask := ^(1 << pos) n &= mask return n } // HasBit provides functionality. func HasBit(n int, pos uint) bool { val := n & (1 << pos) return (val > 0) }