Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
651103bd
Commit
651103bd
authored
Feb 15, 2018
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: adds comment for exported function
parent
4fb7ba45
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
pkg/util/shortid_generator.go
+6
-5
No files found.
pkg/util/shortid_generator.go
View file @
651103bd
...
@@ -14,6 +14,12 @@ var validUidPattern = regexp.MustCompile(`^[a-zA-Z0-9\-\_]*$`).MatchString
...
@@ -14,6 +14,12 @@ var validUidPattern = regexp.MustCompile(`^[a-zA-Z0-9\-\_]*$`).MatchString
var
ErrDashboardInvalidUid
=
errors
.
New
(
"uid contains illegal characters"
)
var
ErrDashboardInvalidUid
=
errors
.
New
(
"uid contains illegal characters"
)
var
ErrDashboardUidToLong
=
errors
.
New
(
"uid to long. max 40 characters"
)
var
ErrDashboardUidToLong
=
errors
.
New
(
"uid to long. max 40 characters"
)
func
init
()
{
gen
,
_
:=
shortid
.
New
(
1
,
allowedChars
,
1
)
shortid
.
SetDefault
(
gen
)
}
// VerifyUid verifies the size and content of the uid
func
VerifyUid
(
uid
string
)
error
{
func
VerifyUid
(
uid
string
)
error
{
if
len
(
uid
)
>
40
{
if
len
(
uid
)
>
40
{
return
ErrDashboardUidToLong
return
ErrDashboardUidToLong
...
@@ -26,11 +32,6 @@ func VerifyUid(uid string) error {
...
@@ -26,11 +32,6 @@ func VerifyUid(uid string) error {
return
nil
return
nil
}
}
func
init
()
{
gen
,
_
:=
shortid
.
New
(
1
,
allowedChars
,
1
)
shortid
.
SetDefault
(
gen
)
}
// GenerateShortUid generates a short unique identifier.
// GenerateShortUid generates a short unique identifier.
func
GenerateShortUid
()
string
{
func
GenerateShortUid
()
string
{
return
shortid
.
MustGenerate
()
return
shortid
.
MustGenerate
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment