hardcode values
john-kelly opened this issue · comments
John Kelly commented
when the value does not come from the api.
{-| -}
hardcoded : a -> Query uniq schema (a -> b) -> Query uniq schema b
hardcoded val (Query queryName schema params queryDecoder) =
Query queryName
schema
params
(apply queryDecoder (Decode.succeed val))
-- example
majorQuery =
PG.query Resources.major Major
|> PG.select .id
|> PG.select .assist_id
|> PG.select .title
|> PG.select .description
|> PG.select .school_id
|> PG.hardcoded True
type alias Major =
{ id : Int
, assist_id : String
, title : String
, description : Maybe String
, school_id : Int
, collapsed : Bool
}