Search: Add inline documentation to sortby.RandomExpr()
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
95584a69ca
commit
0fd3c1790c
1 changed files with 4 additions and 0 deletions
|
@ -15,8 +15,12 @@ const (
|
||||||
func RandomExpr(dialect gorm.Dialect) *gorm.SqlExpr {
|
func RandomExpr(dialect gorm.Dialect) *gorm.SqlExpr {
|
||||||
switch dialect.GetName() {
|
switch dialect.GetName() {
|
||||||
case MySQL:
|
case MySQL:
|
||||||
|
// A seed integer can be passed as an argument, e.g. "RAND(2342)", to generate
|
||||||
|
// reproducible pseudo-random values, see https://mariadb.com/kb/en/rand/.
|
||||||
return gorm.Expr("RAND()")
|
return gorm.Expr("RAND()")
|
||||||
case SQLite3:
|
case SQLite3:
|
||||||
|
// SQLite does not support specifying a seed to generate a deterministic sequence
|
||||||
|
// of pseudo-random values, see https://www.sqlite.org/lang_corefunc.html#random.
|
||||||
return gorm.Expr("RANDOM()")
|
return gorm.Expr("RANDOM()")
|
||||||
default:
|
default:
|
||||||
return gorm.Expr("RAND()")
|
return gorm.Expr("RAND()")
|
||||||
|
|
Loading…
Reference in a new issue