From ef58b25ddb7f30a27a53d16f411fcc3b1841dd03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Nieto?= <jose.carlos@menteslibres.net> Date: Tue, 9 Aug 2016 15:59:45 -0500 Subject: [PATCH] Add test for raw ordering. --- lib/sqlbuilder/builder_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/sqlbuilder/builder_test.go b/lib/sqlbuilder/builder_test.go index 448fd4d2..6deac459 100644 --- a/lib/sqlbuilder/builder_test.go +++ b/lib/sqlbuilder/builder_test.go @@ -116,6 +116,11 @@ func TestSelect(t *testing.T) { b.Select().From("artist").OrderBy("name DESC").String(), ) + assert.Equal( + `SELECT * FROM "artist" ORDER BY RAND()`, + b.Select().From("artist").OrderBy(db.Raw("RAND()")).String(), + ) + assert.Equal( `SELECT * FROM "artist" ORDER BY "name" DESC`, b.Select().From("artist").OrderBy("-name").String(), -- GitLab