MCPcopy
hub / github.com/ent/ent / TestBoolPredicates

Function TestBoolPredicates

dialect/sql/builder_test.go:2062–2077  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2060}
2061
2062func TestBoolPredicates(t *testing.T) {
2063 t1, t2 := Table("users"), Table("posts")
2064 query, args := Select().
2065 From(t1).
2066 Join(t2).
2067 On(t1.C("id"), t2.C("author_id")).
2068 Where(
2069 And(
2070 EQ(t1.C("active"), true),
2071 NEQ(t2.C("deleted"), true),
2072 ),
2073 ).
2074 Query()
2075 require.Nil(t, args)
2076 require.Equal(t, "SELECT * FROM `users` JOIN `posts` AS `t1` ON `users`.`id` = `t1`.`author_id` WHERE `users`.`active` AND NOT `t1`.`deleted`", query)
2077}
2078
2079func TestWindowFunction(t *testing.T) {
2080 posts := Table("posts")

Callers

nothing calls this directly

Calls 11

OnMethod · 0.80
TableFunction · 0.70
SelectFunction · 0.70
AndFunction · 0.70
EQFunction · 0.70
NEQFunction · 0.70
QueryMethod · 0.65
WhereMethod · 0.65
CMethod · 0.65
JoinMethod · 0.45
FromMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…