This repository was archived by the owner on Jun 2, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import (
11
11
12
12
"strings"
13
13
14
+ "github.com/oklog/ulid"
14
15
log "github.com/sirupsen/logrus"
15
16
16
17
"github.com/go-zoo/bone"
@@ -67,7 +68,11 @@ func (c *Context) WebsiteBaseURL() string {
67
68
}
68
69
69
70
func (c * Context ) SiteID () int {
70
- return c .Padlock .SiteID () // short hand... will panic if used improperly
71
+ return c .Padlock .SiteID ()
72
+ }
73
+
74
+ func (c * Context ) SiteULID () int {
75
+ return c .Padlock .SiteULID ()
71
76
}
72
77
73
78
// func (c *Context) GetCacheValue(key string) (string, error) {
@@ -145,6 +150,15 @@ func (ctx *Context) URLIntValues(key string) ([]int, error) {
145
150
return ints , nil
146
151
}
147
152
153
+ func (ctx * Context ) URLULIDParam (key string ) (string , error ) {
154
+ ul := strings .ToUpper (ctx .URLParam (key ))
155
+ id , err := ulid .Parse (ul )
156
+ if err != nil {
157
+ return "" , err
158
+ }
159
+ return id .String (), nil
160
+ }
161
+
148
162
func (ctx * Context ) URLParam (key string ) string {
149
163
// try route param
150
164
value := bone .GetValue (ctx .Req , key )
Original file line number Diff line number Diff line change
1
+ module github.com/nerdynz/flow
2
+
3
+ go 1.14
You can’t perform that action at this time.
0 commit comments