diff options
| author | Felix Hanley <felix@userspace.com.au> | 2020-02-12 02:42:01 +0000 |
|---|---|---|
| committer | Felix Hanley <felix@userspace.com.au> | 2020-02-12 02:42:01 +0000 |
| commit | 03a0d72fb7f79bb3a1b87551f71c299f0624a246 (patch) | |
| tree | 149fb62fbfd57fb49beb5f3fd09dddd973fc7d77 /utils.go | |
| parent | 7296ef29c965552fe1b792669977e9fbecf12760 (diff) | |
| download | sws-03a0d72fb7f79bb3a1b87551f71c299f0624a246.tar.gz sws-03a0d72fb7f79bb3a1b87551f71c299f0624a246.tar.bz2 | |
SVG chart POC
Diffstat (limited to 'utils.go')
| -rw-r--r-- | utils.go | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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 +} |
