stillbox/pkg/database/extend.go

37 lines
1.8 KiB
Go
Raw Normal View History

2024-11-04 23:41:52 -05:00
package database
import (
"strconv"
)
2024-11-15 10:37:58 -05:00
func (d GetTalkgroupsRow) GetTalkgroup() Talkgroup { return d.Talkgroup }
func (d GetTalkgroupsRow) GetSystem() System { return d.System }
2024-11-17 21:46:10 -05:00
func (d GetTalkgroupsRow) GetLearned() bool { return d.Talkgroup.Learned }
2024-11-15 10:37:58 -05:00
func (g GetTalkgroupWithLearnedRow) GetTalkgroup() Talkgroup { return g.Talkgroup }
func (g GetTalkgroupWithLearnedRow) GetSystem() System { return g.System }
2024-11-17 21:46:10 -05:00
func (g GetTalkgroupWithLearnedRow) GetLearned() bool { return g.Talkgroup.Learned }
2024-11-15 10:37:58 -05:00
func (g GetTalkgroupsWithLearnedRow) GetTalkgroup() Talkgroup { return g.Talkgroup }
func (g GetTalkgroupsWithLearnedRow) GetSystem() System { return g.System }
2024-11-17 21:46:10 -05:00
func (g GetTalkgroupsWithLearnedRow) GetLearned() bool { return g.Talkgroup.Learned }
2024-11-15 10:37:58 -05:00
func (g GetTalkgroupsWithLearnedBySystemRow) GetTalkgroup() Talkgroup { return g.Talkgroup }
func (g GetTalkgroupsWithLearnedBySystemRow) GetSystem() System { return g.System }
2024-11-17 21:46:10 -05:00
func (g GetTalkgroupsWithLearnedBySystemRow) GetLearned() bool { return g.Talkgroup.Learned }
2024-11-15 10:37:58 -05:00
func (g Talkgroup) GetTalkgroup() Talkgroup { return g }
func (g Talkgroup) GetSystem() System { return System{ID: int(g.SystemID)} }
func (g Talkgroup) GetLearned() bool { return false }
func (g Talkgroup) String() string {
switch {
case g.AlphaTag != nil:
return *g.AlphaTag
case g.Name != nil && g.TGGroup != nil:
return *g.TGGroup + " " + *g.Name
case g.Name != nil:
return *g.Name + " [" + strconv.Itoa(int(g.TGID)) + "]"
case g.TGGroup != nil:
return *g.TGGroup + " [" + strconv.Itoa(int(g.TGID)) + "]"
}
return strconv.Itoa(int(g.TGID))
}