allow returning custom id columns from queries if they're not composite
This commit is contained in:
parent
12a2d2de2b
commit
48cae5396e
@ -1093,7 +1093,10 @@ instance PersistEntity a => SqlSelect (SqlExpr (Maybe (Entity a))) (Maybe (Entit
|
||||
instance PersistField a => SqlSelect (SqlExpr (Value a)) (Value a) where
|
||||
sqlSelectCols info (ERaw p f) = let (b, vals) = f info
|
||||
in (parensM p b, vals)
|
||||
sqlSelectCols _ (ERawList _) = unexpectedCompositeKeyError
|
||||
sqlSelectCols info (ERawList f) = let (b, vals) = f info
|
||||
in case b of
|
||||
[b'] -> (parensM Parens b', vals)
|
||||
_ -> unexpectedCompositeKeyError
|
||||
sqlSelectColCount = const 1
|
||||
sqlSelectProcessRow [pv] = Value <$> fromPersistValue pv
|
||||
sqlSelectProcessRow _ = Left "SqlSelect (Value a): wrong number of columns."
|
||||
|
||||
Loading…
Reference in New Issue
Block a user