Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { baseconf.IncrementalPkDbEntry[int64] `db:",inline"` ContactID int64 `db:"contact_id"` Type string `db:"type"` Address string `db:"address"` }
func (*Address) MarshalLogObject ¶
func (a *Address) MarshalLogObject(encoder zapcore.ObjectEncoder) error
MarshalLogObject implements the zapcore.ObjectMarshaler interface.
type Contact ¶
type Contact struct { baseconf.IncrementalPkDbEntry[int64] `db:",inline"` 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 { baseconf.IncrementalPkDbEntry[int64] `db:",inline"` Name string `db:"name"` Members []*Contact `db:"-"` }
func (*Group) MarshalLogObject ¶
func (g *Group) MarshalLogObject(encoder zapcore.ObjectEncoder) error
MarshalLogObject implements the zapcore.ObjectMarshaler interface.
type GroupMember ¶
type GroupMember struct { GroupMemberKey `db:",inline"` baseconf.IncrementalDbEntry `db:",inline"` }
func (*GroupMember) GetPrimaryKey ¶
func (g *GroupMember) GetPrimaryKey() GroupMemberKey
GetPrimaryKey is required by the config.IncrementalConfigurable interface.
func (*GroupMember) TableName ¶
func (g *GroupMember) TableName() string
type GroupMemberKey ¶
type GroupMemberKey struct { GroupId int64 `db:"contactgroup_id"` ContactId int64 `db:"contact_id"` }
GroupMemberKey represents the combined primary key of GroupMember.
func (*GroupMemberKey) MarshalLogObject ¶
func (g *GroupMemberKey) 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 { baseconf.IncrementalPkDbEntry[int64] `db:",inline"` ScheduleID int64 `db:"schedule_id"` ActualHandoff types.UnixMilli `db:"actual_handoff"` Priority sql.NullInt32 `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 { baseconf.IncrementalPkDbEntry[int64] `db:",inline"` 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
MarshalLogObject implements the zapcore.ObjectMarshaler interface.
type Schedule ¶
type Schedule struct { baseconf.IncrementalPkDbEntry[int64] `db:",inline"` 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.