MCPcopy Index your code
hub / github.com/ent/ent / TestFieldGT

Function TestFieldGT

dialect/sql/sql_test.go:123–139  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

121}
122
123func TestFieldGT(t *testing.T) {
124 p := FieldGT("stars", 1000)
125 t.Run("MySQL", func(t *testing.T) {
126 s := Dialect(dialect.MySQL).Select("*").From(Table("users"))
127 p(s)
128 query, args := s.Query()
129 require.Equal(t, "SELECT * FROM `users` WHERE `users`.`stars` > ?", query)
130 require.Equal(t, []any{1000}, args)
131 })
132 t.Run("PostgreSQL", func(t *testing.T) {
133 s := Dialect(dialect.Postgres).Select("*").From(Table("users"))
134 p(s)
135 query, args := s.Query()
136 require.Equal(t, `SELECT * FROM "users" WHERE "users"."stars" > $1`, query)
137 require.Equal(t, []any{1000}, args)
138 })
139}
140
141func TestFieldsGT(t *testing.T) {
142 p := FieldsGT("a", "b")

Callers

nothing calls this directly

Calls 7

DialectFunction · 0.85
RunMethod · 0.80
FieldGTFunction · 0.70
TableFunction · 0.70
QueryMethod · 0.65
FromMethod · 0.45
SelectMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…