Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Contact ¶
type Contact struct { ID int64 `db:"id"` FullName string `db:"full_name"` Username sql.NullString `db:"username"` DefaultChannelID int64 `db:"default_channel_id"` Addresses []*Address `db:"-"` }
func (*Contact) MarshalLogObject ¶
func (c *Contact) MarshalLogObject(encoder zapcore.ObjectEncoder) error
MarshalLogObject implements the zapcore.ObjectMarshaler interface.
type Group ¶
type Group struct { ID int64 `db:"id"` Name string `db:"name"` Members []*Contact `db:"-"` MemberIDs []int64 `db:"-"` }
func (*Group) MarshalLogObject ¶
func (g *Group) MarshalLogObject(encoder zapcore.ObjectEncoder) error
MarshalLogObject implements the zapcore.ObjectMarshaler interface.
type Key ¶
type Key struct { // Only one of the members is allowed to be a non-zero value. ContactID types.Int `db:"contact_id"` GroupID types.Int `db:"contactgroup_id"` ScheduleID types.Int `db:"schedule_id"` }
func (Key) MarshalLogObject ¶
func (r Key) MarshalLogObject(encoder zapcore.ObjectEncoder) error
MarshalLogObject implements the zapcore.ObjectMarshaler interface.
This allows us to use `zap.Inline(Key)` or `zap.Object("recipient", Key)` wherever fine-grained logging context is needed, without having to add all the individual fields ourselves each time. https://pkg.go.dev/go.uber.org/zap/zapcore#ObjectMarshaler
func (Key) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface to allow JSON marshaling of map[Key]T.
type Rotation ¶
type Rotation struct { ID int64 `db:"id"` ScheduleID int64 `db:"schedule_id"` ActualHandoff types.UnixMilli `db:"actual_handoff"` Priority int32 `db:"priority"` Name string `db:"name"` Members []*RotationMember `db:"-"` }
func (*Rotation) MarshalLogObject ¶
func (r *Rotation) MarshalLogObject(encoder zapcore.ObjectEncoder) error
MarshalLogObject implements the zapcore.ObjectMarshaler interface.
type RotationMember ¶
type RotationMember struct { ID int64 `db:"id"` RotationID int64 `db:"rotation_id"` Contact *Contact `db:"-"` ContactID sql.NullInt64 `db:"contact_id"` ContactGroup *Group `db:"-"` ContactGroupID sql.NullInt64 `db:"contactgroup_id"` TimePeriodEntries map[int64]*timeperiod.Entry `db:"-"` }
func (*RotationMember) MarshalLogObject ¶
func (r *RotationMember) MarshalLogObject(encoder zapcore.ObjectEncoder) error
type Schedule ¶
type Schedule struct { ID int64 `db:"id"` Name string `db:"name"` Rotations []*Rotation `db:"-"` // contains filtered or unexported fields }
func (*Schedule) GetContactsAt ¶
GetContactsAt returns the contacts that are active in the schedule at the given time.
func (*Schedule) MarshalLogObject ¶
func (s *Schedule) MarshalLogObject(encoder zapcore.ObjectEncoder) error
MarshalLogObject implements the zapcore.ObjectMarshaler interface.
func (*Schedule) RefreshRotations ¶
func (s *Schedule) RefreshRotations()
RefreshRotations updates the internally cached rotations.
This must be called after the Rotations member was updated for the change to become active.