aboutsummaryrefslogtreecommitdiff
path: root/utils.go
diff options
context:
space:
mode:
authorFelix Hanley <felix@userspace.com.au>2020-02-12 02:42:01 +0000
committerFelix Hanley <felix@userspace.com.au>2020-02-12 02:42:01 +0000
commit03a0d72fb7f79bb3a1b87551f71c299f0624a246 (patch)
tree149fb62fbfd57fb49beb5f3fd09dddd973fc7d77 /utils.go
parent7296ef29c965552fe1b792669977e9fbecf12760 (diff)
downloadsws-03a0d72fb7f79bb3a1b87551f71c299f0624a246.tar.gz
sws-03a0d72fb7f79bb3a1b87551f71c299f0624a246.tar.bz2
SVG chart POC
Diffstat (limited to 'utils.go')
-rw-r--r--utils.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/utils.go b/utils.go
index 8e4835e..13cfc2b 100644
--- a/utils.go
+++ b/utils.go
@@ -1,6 +1,9 @@
package sws
-import "time"
+import (
+ "github.com/speps/go-hashids"
+ "time"
+)
func ptrString(s string) *string {
if s == "" {
@@ -12,3 +15,11 @@ func ptrString(s string) *string {
func ptrTime(t time.Time) *time.Time {
return &t
}
+
+func hashID(salt string, id int) string {
+ hd := hashids.NewData()
+ hd.Salt = salt
+ h, _ := hashids.NewWithData(hd)
+ out, _ := h.Encode([]int{id})
+ return out
+}