module Rel8.Expr.Sequence
  ( nextval
  )
where

-- base
import Data.Int ( Int64 )
import Prelude

-- rel8
import Rel8.Expr ( Expr )
import Rel8.Expr.Function ( function )
import Rel8.Expr.Serialize ( litExpr )

-- text
import Data.Text ( pack )


-- | See https://www.postgresql.org/docs/current/functions-sequence.html
nextval :: String -> Expr Int64
nextval :: String -> Expr Int64
nextval = String -> Expr Text -> Expr Int64
forall args result.
Function args result =>
String -> args -> result
function String
"nextval" (Expr Text -> Expr Int64)
-> (String -> Expr Text) -> String -> Expr Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Expr Text
forall a. Sql DBType a => a -> Expr a
litExpr (Text -> Expr Text) -> (String -> Text) -> String -> Expr Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
pack