git.iko.soy/rowtype-yoga/purescript-yoga-scylladb
on main help sign in
checkpoint
c03e270Mark
compile-fail/AllowFilteringOnInsert.pursnew file+16
@@ -0,0 +1,16 @@
1+-- expect: HasClause "select"
2+module CompileFail.AllowFilteringOnInsert where
3+import Prelude
4+
5+import Yoga.ScyllaDB.Schema as S
6+import Yoga.ScyllaDB.ScyllaDB as Scylla
7+import Type.Function (type (#))
8+import Type.Proxy (Proxy(..))
9+import Unsafe.Coerce (unsafeCoerce)
10+
11+type UsersTable = S.Table "users"
12+ ( id :: Scylla.UUID # S.PartitionKey
13+ , name :: String
14+ )
15+
16+bad = S.from (Proxy :: Proxy UsersTable) # S.insert { id: (unsafeCoerce "" :: Scylla.UUID), name: "x" } # S.allowFiltering
compile-fail/DeleteThenSet.pursnew file+15
@@ -0,0 +1,15 @@
1+-- expect: Lacks "delete"
2+module CompileFail.DeleteThenSet where
3+import Prelude
4+
5+import Yoga.ScyllaDB.Schema as S
6+import Yoga.ScyllaDB.ScyllaDB as Scylla
7+import Type.Function (type (#))
8+import Type.Proxy (Proxy(..))
9+
10+type UsersTable = S.Table "users"
11+ ( id :: Scylla.UUID # S.PartitionKey
12+ , name :: String
13+ )
14+
15+bad = S.from (Proxy :: Proxy UsersTable) # S.delete # S.set { name: "x" }
compile-fail/DoubleAllowFiltering.pursnew file+15
@@ -0,0 +1,15 @@
1+-- expect: Lacks "allowFiltering"
2+module CompileFail.DoubleAllowFiltering where
3+import Prelude
4+
5+import Yoga.ScyllaDB.Schema as S
6+import Yoga.ScyllaDB.ScyllaDB as Scylla
7+import Type.Function (type (#))
8+import Type.Proxy (Proxy(..))
9+
10+type UsersTable = S.Table "users"
11+ ( id :: Scylla.UUID # S.PartitionKey
12+ , name :: String
13+ )
14+
15+bad = S.from (Proxy :: Proxy UsersTable) # S.selectAll # S.where_ @"name = $name" # S.allowFiltering # S.allowFiltering
compile-fail/DoubleLimit.pursnew file+15
@@ -0,0 +1,15 @@
1+-- expect: Lacks "limit"
2+module CompileFail.DoubleLimit where
3+import Prelude
4+
5+import Yoga.ScyllaDB.Schema as S
6+import Yoga.ScyllaDB.ScyllaDB as Scylla
7+import Type.Function (type (#))
8+import Type.Proxy (Proxy(..))
9+
10+type UsersTable = S.Table "users"
11+ ( id :: Scylla.UUID # S.PartitionKey
12+ , name :: String
13+ )
14+
15+bad = S.from (Proxy :: Proxy UsersTable) # S.selectAll # S.limit @"10" # S.limit @"5"
compile-fail/DoubleOrderBy.pursnew file+15
@@ -0,0 +1,15 @@
1+-- expect: Lacks "orderBy"
2+module CompileFail.DoubleOrderBy where
3+import Prelude
4+
5+import Yoga.ScyllaDB.Schema as S
6+import Yoga.ScyllaDB.ScyllaDB as Scylla
7+import Type.Function (type (#))
8+import Type.Proxy (Proxy(..))
9+
10+type UsersTable = S.Table "users"
11+ ( id :: Scylla.UUID # S.PartitionKey
12+ , name :: String
13+ )
14+
15+bad = S.from (Proxy :: Proxy UsersTable) # S.selectAll # S.orderBy @"name" # S.orderBy @"id"
compile-fail/IfNotExistsOnDelete.pursnew file+15
@@ -0,0 +1,15 @@
1+-- expect: HasClause "insert"
2+module CompileFail.IfNotExistsOnDelete where
3+import Prelude
4+
5+import Yoga.ScyllaDB.Schema as S
6+import Yoga.ScyllaDB.ScyllaDB as Scylla
7+import Type.Function (type (#))
8+import Type.Proxy (Proxy(..))
9+
10+type UsersTable = S.Table "users"
11+ ( id :: Scylla.UUID # S.PartitionKey
12+ , name :: String
13+ )
14+
15+bad = S.from (Proxy :: Proxy UsersTable) # S.delete # S.where_ @"id = $id" # S.ifNotExists
compile-fail/OrderByAfterLimit.pursnew file+15
@@ -0,0 +1,15 @@
1+-- expect: Lacks "limit"
2+module CompileFail.OrderByAfterLimit where
3+import Prelude
4+
5+import Yoga.ScyllaDB.Schema as S
6+import Yoga.ScyllaDB.ScyllaDB as Scylla
7+import Type.Function (type (#))
8+import Type.Proxy (Proxy(..))
9+
10+type UsersTable = S.Table "users"
11+ ( id :: Scylla.UUID # S.PartitionKey
12+ , name :: String
13+ )
14+
15+bad = S.from (Proxy :: Proxy UsersTable) # S.selectAll # S.limit @"10" # S.orderBy @"name"
compile-fail/SelectNonexistentColumn.pursnew file+15
@@ -0,0 +1,15 @@
1+-- expect: Column not found in table
2+module CompileFail.SelectNonexistentColumn where
3+import Prelude
4+
5+import Yoga.ScyllaDB.Schema as S
6+import Yoga.ScyllaDB.ScyllaDB as Scylla
7+import Type.Function (type (#))
8+import Type.Proxy (Proxy(..))
9+
10+type UsersTable = S.Table "users"
11+ ( id :: Scylla.UUID # S.PartitionKey
12+ , name :: String
13+ )
14+
15+bad = S.from (Proxy :: Proxy UsersTable) # S.select @"nonexistent"
compile-fail/SetNonexistentColumn.pursnew file+15
@@ -0,0 +1,15 @@
1+-- expect: Could not match type
2+module CompileFail.SetNonexistentColumn where
3+import Prelude
4+
5+import Yoga.ScyllaDB.Schema as S
6+import Yoga.ScyllaDB.ScyllaDB as Scylla
7+import Type.Function (type (#))
8+import Type.Proxy (Proxy(..))
9+
10+type UsersTable = S.Table "users"
11+ ( id :: Scylla.UUID # S.PartitionKey
12+ , name :: String
13+ )
14+
15+bad = S.from (Proxy :: Proxy UsersTable) # S.set { bogus: "x" }
compile-fail/WhereAfterLimit.pursnew file+15
@@ -0,0 +1,15 @@
1+-- expect: Lacks "limit"
2+module CompileFail.WhereAfterLimit where
3+import Prelude
4+
5+import Yoga.ScyllaDB.Schema as S
6+import Yoga.ScyllaDB.ScyllaDB as Scylla
7+import Type.Function (type (#))
8+import Type.Proxy (Proxy(..))
9+
10+type UsersTable = S.Table "users"
11+ ( id :: Scylla.UUID # S.PartitionKey
12+ , name :: String
13+ )
14+
15+bad = S.from (Proxy :: Proxy UsersTable) # S.selectAll # S.limit @"10" # S.where_ @"id = $id"
compile-fail/WhereAfterOrderBy.pursnew file+15
@@ -0,0 +1,15 @@
1+-- expect: Lacks "orderBy"
2+module CompileFail.WhereAfterOrderBy where
3+import Prelude
4+
5+import Yoga.ScyllaDB.Schema as S
6+import Yoga.ScyllaDB.ScyllaDB as Scylla
7+import Type.Function (type (#))
8+import Type.Proxy (Proxy(..))
9+
10+type UsersTable = S.Table "users"
11+ ( id :: Scylla.UUID # S.PartitionKey
12+ , name :: String
13+ )
14+
15+bad = S.from (Proxy :: Proxy UsersTable) # S.selectAll # S.orderBy @"name" # S.where_ @"id = $id"
compile-fail/WhereNonexistentParam.pursnew file+15
@@ -0,0 +1,15 @@
1+-- expect: Column not found in table
2+module CompileFail.WhereNonexistentParam where
3+import Prelude
4+
5+import Yoga.ScyllaDB.Schema as S
6+import Yoga.ScyllaDB.ScyllaDB as Scylla
7+import Type.Function (type (#))
8+import Type.Proxy (Proxy(..))
9+
10+type UsersTable = S.Table "users"
11+ ( id :: Scylla.UUID # S.PartitionKey
12+ , name :: String
13+ )
14+
15+bad = S.from (Proxy :: Proxy UsersTable) # S.selectAll # S.where_ @"bogus = $bogus"
compile-fail/WithTTLAfterSelect.pursnew file+15
@@ -0,0 +1,15 @@
1+-- expect: Lacks "select"
2+module CompileFail.WithTTLAfterSelect where
3+import Prelude
4+
5+import Yoga.ScyllaDB.Schema as S
6+import Yoga.ScyllaDB.ScyllaDB as Scylla
7+import Type.Function (type (#))
8+import Type.Proxy (Proxy(..))
9+
10+type UsersTable = S.Table "users"
11+ ( id :: Scylla.UUID # S.PartitionKey
12+ , name :: String
13+ )
14+
15+bad = S.from (Proxy :: Proxy UsersTable) # S.selectAll # S.withTTL @"3600"
src/Yoga/ScyllaDB/Schema.purs+2−1
@@ -772,7 +772,8 @@ else instance
772class ResolveParamType :: Symbol -> RL.RowList Type -> Type -> Constraint
772class ResolveParamType :: Symbol -> RL.RowList Type -> Type -> Constraint
773class ResolveParamType name rl typ | name rl -> typ
773class ResolveParamType name rl typ | name rl -> typ
774
774
775+instance Fail (Text "Column not found in table") => ResolveParamType name RL.Nil typ
775−instance (ExtractType entry typ) => ResolveParamType name (RL.Cons name entry tail) typ
776+else instance (ExtractType entry typ) => ResolveParamType name (RL.Cons name entry tail) typ
776else instance ResolveParamType name tail typ => ResolveParamType name (RL.Cons other entry tail) typ
777else instance ResolveParamType name tail typ => ResolveParamType name (RL.Cons other entry tail) typ
777
778
778-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
779-- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━