Add Uniq() rpc method for crypto-secure rando ids
This commit is contained in:
parent
779251bc54
commit
15e9f77434
1 changed files with 5 additions and 0 deletions
|
@ -19,10 +19,15 @@ import (
|
||||||
"github.com/abcum/surreal/cnf"
|
"github.com/abcum/surreal/cnf"
|
||||||
"github.com/abcum/surreal/db"
|
"github.com/abcum/surreal/db"
|
||||||
"github.com/abcum/surreal/sql"
|
"github.com/abcum/surreal/sql"
|
||||||
|
"github.com/abcum/surreal/util/rand"
|
||||||
)
|
)
|
||||||
|
|
||||||
type rpc struct{}
|
type rpc struct{}
|
||||||
|
|
||||||
|
func (r *rpc) Uniq(c *fibre.Context) (interface{}, error) {
|
||||||
|
return rand.String(128), nil
|
||||||
|
}
|
||||||
|
|
||||||
func (r *rpc) Info(c *fibre.Context) (interface{}, error) {
|
func (r *rpc) Info(c *fibre.Context) (interface{}, error) {
|
||||||
return c.Get("auth").(*cnf.Auth).Data, nil
|
return c.Get("auth").(*cnf.Auth).Data, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue