From 2b7a4dcac063b500918bac092e09a340076d514b Mon Sep 17 00:00:00 2001 From: Vladislav Veselskiy Date: Mon, 27 Jan 2025 12:53:40 +0300 Subject: [PATCH] Add type PushId. --- go.mod | 3 +++ push_common.go | 8 ++++++++ util.go | 7 +++++++ 3 files changed, 18 insertions(+) create mode 100644 go.mod create mode 100644 util.go diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..8a4847e --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module git.bit5.ru/backend/push_common + +go 1.19 diff --git a/push_common.go b/push_common.go index 5557953..66860eb 100644 --- a/push_common.go +++ b/push_common.go @@ -1,5 +1,13 @@ package push_common +type PushId uint32 + +func (id PushId) String() string { + return uint32ToString(uint32(id)) +} + +//----------------------------------------------------------------------------- + type TextVariant struct { Lang int `json:"lang"` Title string `json:"title"` diff --git a/util.go b/util.go new file mode 100644 index 0000000..2f3c6cd --- /dev/null +++ b/util.go @@ -0,0 +1,7 @@ +package push_common + +import "strconv" + +func uint32ToString(n uint32) string { + return strconv.FormatUint(uint64(n), 10) +}