github.com/kunlun-qilian/sqlx/v3@v3.0.0/builder/functions_test.go (about)

     1  package builder_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/kunlun-qilian/sqlx/v3/builder"
     7  	. "github.com/kunlun-qilian/sqlx/v3/builder/buidertestingutils"
     8  	"github.com/onsi/gomega"
     9  )
    10  
    11  func TestFunc(t *testing.T) {
    12  	t.Run("invalid", func(t *testing.T) {
    13  		gomega.NewWithT(t).Expect(Func("")).To(BeExpr(""))
    14  	})
    15  	t.Run("count", func(t *testing.T) {
    16  		gomega.NewWithT(t).Expect(Count()).To(BeExpr("COUNT(1)"))
    17  	})
    18  	t.Run("AVG", func(t *testing.T) {
    19  		gomega.NewWithT(t).Expect(Avg()).To(BeExpr("AVG(*)"))
    20  	})
    21  }