renamed PseudoRandom to Pseudorandom
This commit is contained in:
@@ -133,7 +133,7 @@ func (f FilterData) resolveToken(token fexpr.Token, fieldResolver FieldResolver)
|
||||
// current datetime constant
|
||||
// ---
|
||||
if token.Literal == "@now" {
|
||||
placeholder := "t" + security.PseudoRandomString(8)
|
||||
placeholder := "t" + security.PseudorandomString(8)
|
||||
name := fmt.Sprintf("{:%s}", placeholder)
|
||||
params := dbx.Params{placeholder: types.NowDateTime().String()}
|
||||
|
||||
@@ -161,13 +161,13 @@ func (f FilterData) resolveToken(token fexpr.Token, fieldResolver FieldResolver)
|
||||
|
||||
return name, params, err
|
||||
case fexpr.TokenText:
|
||||
placeholder := "t" + security.PseudoRandomString(8)
|
||||
placeholder := "t" + security.PseudorandomString(8)
|
||||
name := fmt.Sprintf("{:%s}", placeholder)
|
||||
params := dbx.Params{placeholder: token.Literal}
|
||||
|
||||
return name, params, nil
|
||||
case fexpr.TokenNumber:
|
||||
placeholder := "t" + security.PseudoRandomString(8)
|
||||
placeholder := "t" + security.PseudorandomString(8)
|
||||
name := fmt.Sprintf("{:%s}", placeholder)
|
||||
params := dbx.Params{placeholder: cast.ToFloat64(token.Literal)}
|
||||
|
||||
|
||||
@@ -38,16 +38,16 @@ func RandomStringWithAlphabet(length int, alphabet string) string {
|
||||
//
|
||||
// The generated string matches [A-Za-z0-9]+ and it's transparent to URL-encoding.
|
||||
//
|
||||
// For a cryptographically random string (but a little bit slower) use PseudoRandomString instead.
|
||||
func PseudoRandomString(length int) string {
|
||||
// For a cryptographically random string (but a little bit slower) use PseudorandomString instead.
|
||||
func PseudorandomString(length int) string {
|
||||
return RandomStringWithAlphabet(length, defaultRandomAlphabet)
|
||||
}
|
||||
|
||||
// PseudoRandomStringWithAlphabet generates a pseudorandom string
|
||||
// PseudorandomStringWithAlphabet generates a pseudorandom string
|
||||
// with the specified length and characters set.
|
||||
//
|
||||
// For a cryptographically random (but a little bit slower) use RandomStringWithAlphabet instead.
|
||||
func PseudoRandomStringWithAlphabet(length int, alphabet string) string {
|
||||
func PseudorandomStringWithAlphabet(length int, alphabet string) string {
|
||||
b := make([]byte, length)
|
||||
max := len(alphabet)
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@ func TestRandomStringWithAlphabet(t *testing.T) {
|
||||
testRandomStringWithAlphabet(t, security.RandomStringWithAlphabet)
|
||||
}
|
||||
|
||||
func TestPseudoRandomString(t *testing.T) {
|
||||
testRandomString(t, security.PseudoRandomString)
|
||||
func TestPseudorandomString(t *testing.T) {
|
||||
testRandomString(t, security.PseudorandomString)
|
||||
}
|
||||
|
||||
func TestPseudoRandomStringWithAlphabet(t *testing.T) {
|
||||
testRandomStringWithAlphabet(t, security.PseudoRandomStringWithAlphabet)
|
||||
func TestPseudorandomStringWithAlphabet(t *testing.T) {
|
||||
testRandomStringWithAlphabet(t, security.PseudorandomStringWithAlphabet)
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user