From 780ade3dc066afb8a43be824373414f3d316ebd6 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 21 Sep 2024 13:42:36 +0300 Subject: jo --- internal/types/platformname.go | 9 +++++++++ internal/types/shared.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 internal/types/platformname.go create mode 100644 internal/types/shared.go (limited to 'internal/types') diff --git a/internal/types/platformname.go b/internal/types/platformname.go new file mode 100644 index 0000000..e94d422 --- /dev/null +++ b/internal/types/platformname.go @@ -0,0 +1,9 @@ +package types + +type PlatformName = string + +const ( + Mastodon PlatformName = "Mastodon" + LinkedIn PlatformName = "LinkedIn" + Textfile PlatformName = "Textfile" +) diff --git a/internal/types/shared.go b/internal/types/shared.go new file mode 100644 index 0000000..c2d5a65 --- /dev/null +++ b/internal/types/shared.go @@ -0,0 +1,29 @@ +package types + +import ( + "fmt" + "time" +) + +type UnixEpoch int64 + +// Tells me whether the entry was Shared to the sm platform named Name +type Shared struct { + Is bool `json:"is,omitempty"` + Timestamp UnixEpoch `json:"timestamp,omitempty"` +} + +func newShared(is bool) Shared { + return Shared{ + Is: is, + Timestamp: UnixEpoch(time.Now().Unix()), + } +} + +func (s Shared) String() string { + return fmt.Sprintf("Is:%v;Timestamp:%v", s.Is, s.Timestamp) +} + +func (s Shared) Equals(other Shared) bool { + return s.Timestamp == other.Timestamp && s.Is == other.Is +} -- cgit v1.2.3