diff options
| author | Paul Buetow <paul@buetow.org> | 2024-09-21 13:42:36 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-09-21 13:42:36 +0300 |
| commit | 780ade3dc066afb8a43be824373414f3d316ebd6 (patch) | |
| tree | 5b2e1f1a478bcc5469e4f0456f13464062c8e2a4 /internal/types | |
| parent | 5263e61d5667009e7a7ac13014cec73ccbd0e20a (diff) | |
jo
Diffstat (limited to 'internal/types')
| -rw-r--r-- | internal/types/platformname.go | 9 | ||||
| -rw-r--r-- | internal/types/shared.go | 29 |
2 files changed, 38 insertions, 0 deletions
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 +} |
