Skip to content

Commit

Permalink
Merge pull request #125 from OxfordAbstracts/add-hasura-text-typename
Browse files Browse the repository at this point in the history
Add hasura text typename
  • Loading branch information
roryc89 authored Jul 25, 2023
2 parents 14ed132 + 7a3721f commit efc9772
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/GraphQL/Hasura/Array.purs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import Data.Newtype (class Newtype, unwrap)
import Data.String (joinWith)
import GraphQL.Client.Args (class ArgGql)
import GraphQL.Client.ToGqlString (class GqlArgString)
import GraphQL.Client.Variables.TypeName (class VarTypeName)
import GraphQL.Hasura.Decode (class DecodeHasura)
import GraphQL.Hasura.Encode (class EncodeHasura)


-- | A purescript type that maps to the hasura graphql `_text` type
newtype Hasura_text = Hasura_text (Array String)

Expand All @@ -21,10 +21,13 @@ derive newtype instance DecodeHasura Hasura_text

derive newtype instance Eq Hasura_text

instance Show Hasura_text where
instance Show Hasura_text where
show a = "(Hasura_text " <> show a <> ")"

instance GqlArgString Hasura_text where
instance GqlArgString Hasura_text where
toGqlArgStringImpl = unwrap >>> map show >>> joinWith "," >>> (\s -> "{" <> s <> "}") >>> show

instance ArgGql Hasura_text Hasura_text

instance VarTypeName Hasura_text where
varTypeName _ = "_text"

0 comments on commit efc9772

Please sign in to comment.