gitee.com/eden-framework/sqlx@v0.0.3/builder/addition_order_by_test.go (about) 1 package builder_test 2 3 import ( 4 "testing" 5 6 . "gitee.com/eden-framework/sqlx/builder" 7 . "gitee.com/eden-framework/sqlx/builder/buidertestingutils" 8 "github.com/onsi/gomega" 9 ) 10 11 func TestOrderBy(t *testing.T) { 12 table := T("T") 13 14 t.Run("select Order", func(t *testing.T) { 15 gomega.NewWithT(t).Expect( 16 Select(nil). 17 From( 18 table, 19 OrderBy( 20 AscOrder(Col("F_a")), 21 DescOrder(Col("F_b")), 22 ), 23 Where(Col("F_a").Eq(1)), 24 ), 25 ).To(BeExpr( 26 ` 27 SELECT * FROM T 28 WHERE f_a = ? 29 ORDER BY (f_a) ASC,(f_b) DESC 30 `, 31 1, 32 )) 33 }) 34 }