recipient

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: GPL-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

func (*Address) TableName

func (a *Address) TableName() string

type Contact

type Contact struct {
	baseconf.IncrementalPkDbEntry[int64] `db:",inline"`

	ExternalUUID     types.UUID   `db:"external_uuid"`
	FullName         string       `db:"full_name"`
	Username         types.String `db:"username"`
	DefaultChannelID int64        `db:"default_channel_id"`
	Addresses        []*Address   `db:"-"`
}

func (*Contact) GetContactsAt

func (c *Contact) GetContactsAt(t time.Time) []*Contact

func (*Contact) MarshalLogObject

func (c *Contact) MarshalLogObject(encoder zapcore.ObjectEncoder) error

MarshalLogObject implements the zapcore.ObjectMarshaler interface.

func (*Contact) String

func (c *Contact) String() string

type Group

type Group struct {
	baseconf.IncrementalPkDbEntry[int64] `db:",inline"`

	ExternalUUID types.UUID `db:"external_uuid"`
	Name         string     `db:"name"`
	Members      []*Contact `db:"-"`
}

func (*Group) GetContactsAt

func (g *Group) GetContactsAt(t time.Time) []*Contact

func (*Group) MarshalLogObject

func (g *Group) MarshalLogObject(encoder zapcore.ObjectEncoder) error

MarshalLogObject implements the zapcore.ObjectMarshaler interface.

func (*Group) String

func (g *Group) String() string

func (*Group) TableName

func (g *Group) TableName() string

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 ToKey

func ToKey(r Recipient) Key

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

func (r Key) MarshalText() (text []byte, err error)

MarshalText implements the encoding.TextMarshaler interface to allow JSON marshaling of map[Key]T.

type Recipient

type Recipient interface {
	fmt.Stringer
	zapcore.ObjectMarshaler

	GetContactsAt(t time.Time) []*Contact
}

type Role added in v1.0.0

type Role int
const (
	RoleNone Role = iota
	RoleRecipient
	RoleSubscriber
	RoleManager
)

func (*Role) Scan added in v1.0.0

func (c *Role) Scan(src any) error

Scan implements the sql.Scanner interface.

func (Role) String added in v1.0.0

func (c Role) String() string

func (Role) Value added in v1.0.0

func (c Role) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

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

func (s *Schedule) GetContactsAt(t time.Time) []*Contact

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.

func (*Schedule) String

func (s *Schedule) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL