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

Function TestFieldLT

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

Source from the content-addressed store, hash-verified

193}
194
195func TestFieldLT(t *testing.T) {
196 p := FieldLT("stars", 1000)
197 t.Run("MySQL", func(t *testing.T) {
198 s := Dialect(dialect.MySQL).Select("*").From(Table("users"))
199 p(s)
200 query, args := s.Query()
201 require.Equal(t, "SELECT * FROM `users` WHERE `users`.`stars` < ?", query)
202 require.Equal(t, []any{1000}, args)
203 })
204 t.Run("PostgreSQL", func(t *testing.T) {
205 s := Dialect(dialect.Postgres).Select("*").From(Table("users"))
206 p(s)
207 query, args := s.Query()
208 require.Equal(t, `SELECT * FROM "users" WHERE "users"."stars" < $1`, query)
209 require.Equal(t, []any{1000}, args)
210 })
211}
212
213func TestFieldsLT(t *testing.T) {
214 p := FieldsLT("a", "b")

Callers

nothing calls this directly

Calls 7

DialectFunction · 0.85
RunMethod · 0.80
FieldLTFunction · 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…