feat: publish standalone worker
Separate worker packaging and service lifecycle from the control plane.
Этот коммит содержится в:
31
app/models/bits.go
Обычный файл
31
app/models/bits.go
Обычный файл
@@ -0,0 +1,31 @@
|
||||
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)
|
||||
}
|
||||
Ссылка в новой задаче
Block a user