module Cassandra.Helpers (toOptionFieldName) where
import Data.Aeson.TH
import Imports
toOptionFieldName :: Options
toOptionFieldName :: Options
toOptionFieldName = Options
defaultOptions {fieldLabelModifier = lowerFirst . dropPrefix}
where
lowerFirst :: String -> String
lowerFirst :: String -> String
lowerFirst (Char
x : String
xs) = Char -> Char
toLower Char
x Char -> String -> String
forall a. a -> [a] -> [a]
: String
xs
lowerFirst [] = String
""
dropPrefix :: String -> String
dropPrefix :: String -> String
dropPrefix = (Char -> Bool) -> String -> String
forall a. (a -> Bool) -> [a] -> [a]
dropWhile (Char
'_' ==)