Documentation ¶
Index ¶
- Constants
- Variables
- func CheckBeginEnd(begin, end time.Time, pastAlways bool, future time.Duration) error
- func GetInterval(repo Repository, pad *Pad, from, to time.Time, location *time.Location) ([]Event, []Shift, error)
- func GetSystemLocation() *time.Location
- func Intersect(as, bs []string) []string
- func Locations(loc string) []string
- func NewShareID() string
- func Union(as, bs []string) []string
- type Auth
- func (auth Auth) Active() bool
- func (auth Auth) CanApply(shiftname string) bool
- func (auth Auth) CanApplyName(shift Shift, name string) bool
- func (auth Auth) CanApplyShift(shift Shift) bool
- func (auth Auth) CanEdit(shiftname string) bool
- func (auth Auth) CanEditAnyShift() bool
- func (auth Auth) CanEditShift(shift Shift) bool
- func (auth Auth) CanPayout() bool
- func (auth Auth) CanPayoutTake(shift Shift, take Take) bool
- func (auth Auth) CanTake(shiftname string) bool
- func (auth Auth) CanTakeShift(shift Shift) bool
- func (auth Auth) CanTakerName(shift Shift, name string) bool
- func (auth Auth) Encode() []byte
- func (ref Auth) Restrict(input Auth) Auth
- type AuthPad
- type Day
- type Event
- type Pad
- type Repository
- type Share
- type Shift
- func (shift Shift) AfterDeadline(deadline string) bool
- func (shift Shift) FullyTaken() bool
- func (shift Shift) HasPayouts() bool
- func (shift Shift) Hours() float64
- func (shift Shift) Over() bool
- func (shift Shift) String() string
- func (shift Shift) TakeViews(auth Auth) []Take
- func (shift Shift) Untaken() []struct{}
- type Take
- type Week
Constants ¶
const MaxFuture = 180 * 24 * time.Hour
MaxFuture specifies how far in the future shifts can be created and edited, and the expiry time of pads.
Variables ¶
var SystemLocation *time.Location = GetSystemLocation()
Functions ¶
func CheckBeginEnd ¶
CheckBeginEnd checks that begin or end are non-zero, that end is after begin (or end is zero), and that begin and end are not too far in the past and future.
func GetInterval ¶
func GetInterval(repo Repository, pad *Pad, from, to time.Time, location *time.Location) ([]Event, []Shift, error)
weeks can't be split into days because shifts and events may be contained in multiple days then, but we want them just once in a week (or any other interval)
func GetSystemLocation ¶
GetSystemLocation returns the location linked by /etc/localtime if it is a canonical location, or "Etc/GMT" else.
func Locations ¶
Locations returns the list of canonical locations plus the given location, which might be a legacy one.
func NewShareID ¶ added in v0.8.0
func NewShareID() string
Types ¶
type Auth ¶
type Auth struct { Admin bool Apply []string ApplyAll bool Edit []string EditAll bool EditRetroAlways bool Expires string // yyyy-mm-dd Note string PayoutAll bool Take []string TakeAll bool TakeDeadline string // apply and take, cronexpr TakerName []string // apply and take TakerNameAll bool // apply and take ViewTakerContact bool ViewTakerName bool // also visible if contained in Auth.TakerName }
func DecodeAuth ¶
func (Auth) CanApplyName ¶ added in v0.5.0
func (Auth) CanApplyShift ¶ added in v0.5.0
func (Auth) CanEditAnyShift ¶ added in v0.7.0
func (Auth) CanEditShift ¶
When editing a shift, CanEditShift must be called on the original and on the modified shift.
func (Auth) CanPayoutTake ¶ added in v0.6.0
func (Auth) CanTakeShift ¶
type AuthPad ¶
type AuthPad struct { *Pad }
func (AuthPad) EditShiftNames ¶
EditShiftNames returns the shift names that may be edited explicitly. You must check EditAll separately.
type Day ¶
type Day struct { Begin time.Time // inclusive End time.Time // exclusive Events []Event Shifts []Shift // shifts without an event }
type Pad ¶
type Repository ¶
type Shift ¶
type Shift struct { ID int Modified time.Time // used in ical export Name string // matched against Pad.ShiftNames Note string Paid bool EventUID string Quantity int Begin time.Time // required End time.Time // required Takes []Take }