Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteLeaveAllowance ¶
func DeleteLeaveRequest ¶
Types ¶
type Job ¶
type Job struct {
ID uint64 `gorm:"column:id; primary_key:yes"`
ExportSecret string
User User
UserID uint64 `gorm:"column:user_id"`
StartTime time.Time `sql:"DEFAULT:null"`
EndTime time.Time `sql:"DEFAULT:null"`
EmployerName string
LeaveAllowances []LeaveAllowance
LeaveRequests []LeaveRequest
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt time.Time
}
func FindJobFromExportSecret ¶
func (*Job) CurrentLeaveAllowance ¶
func (j *Job) CurrentLeaveAllowance() (l LeaveAllowance, _ error)
func (*Job) LeavePeriods ¶
func (j *Job) LeavePeriods() (l []LeaveAllowance, _ error)
func (*Job) RequestsLastYearAndFuture ¶
func (j *Job) RequestsLastYearAndFuture() (requests []LeaveRequest, err error)
type LeaveAllowance ¶
type LeaveAllowance struct {
ID uint64 `gorm:"column:id; primary_key:yes"`
Job Job
JobID uint64 `gorm:"column:job_id"`
StartTime time.Time `sql:"DEFAULT:null"`
EndTime time.Time `sql:"DEFAULT:null"`
Minutes int32
Description string
IsAdjustment bool
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt time.Time
}
func FindLeaveAllowance ¶
func FindLeaveAllowance(id, jobID uint64) (l LeaveAllowance, err error)
func (*LeaveAllowance) IntersectsLeaveRequest ¶
func (a *LeaveAllowance) IntersectsLeaveRequest() (intersects LeaveRequest, _ error)
IntersectsLeaveRequests checks if a leave allowance starts or ends part-way through any existing leave requests for the same job.
This query can be used to ensure that changes to a leave allowance will not cause leave requests to span leave allowance periods, which is currently not supported.
func (*LeaveAllowance) OverlapsAnother ¶
func (a *LeaveAllowance) OverlapsAnother() (overlaps LeaveAllowance, _ error)
func (*LeaveAllowance) RemainingTime ¶
func (l *LeaveAllowance) RemainingTime() (minutes int32, err error)
func (*LeaveAllowance) Save ¶
func (a *LeaveAllowance) Save() error
type LeaveRequest ¶
type LeaveRequest struct {
ID uint64 `gorm:"column:id; primary_key:yes"`
Job Job
JobID uint64 `gorm:"column:job_id"`
Minutes uint32
Description string
StartTime time.Time `sql:"DEFAULT:null"`
EndTime time.Time `sql:"DEFAULT:null"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt time.Time
}
func FindLeaveRequest ¶
func FindLeaveRequest(id, jobID uint64) (l LeaveRequest, err error)
func (*LeaveRequest) FitsExistingAllowancePeriod ¶
func (r *LeaveRequest) FitsExistingAllowancePeriod() (result int, err error)
func (*LeaveRequest) Save ¶
func (r *LeaveRequest) Save() error
type User ¶
type User struct {
ID uint64 `gorm:"column:id; primary_key:yes"`
Name string `sql:"type:text;"`
GitHubID uint64 `gorm:"column:github_id"`
Email string `sql:"type:text;"`
TZOffset int16 `gorm:"column:tz_offset"` // time zone as seconds east of UTC
Jobs []Job
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt time.Time
}
func (*User) CurrentJob ¶
func (*User) TZLocation ¶
func (*User) UpdateOrCreate ¶
Click to show internal directories.
Click to hide internal directories.