{-# LANGUAGE BangPatterns, DeriveDataTypeable, FlexibleInstances, MultiParamTypeClasses #-} module Database.RethinkDB.Internal.Query_Language.Builtin.GroupedMapReduce (GroupedMapReduce(..)) where import Prelude ((+), (/)) import qualified Prelude as Prelude' import qualified Data.Typeable as Prelude' import qualified Data.Data as Prelude' import qualified Text.ProtocolBuffers.Header as P' import qualified Database.RethinkDB.Internal.Query_Language.Mapping as Query_Language (Mapping) import qualified Database.RethinkDB.Internal.Query_Language.Reduction as Query_Language (Reduction) data GroupedMapReduce = GroupedMapReduce{group_mapping :: !Query_Language.Mapping, value_mapping :: !Query_Language.Mapping, reduction :: !Query_Language.Reduction} deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data) instance P'.Mergeable GroupedMapReduce where mergeAppend (GroupedMapReduce x'1 x'2 x'3) (GroupedMapReduce y'1 y'2 y'3) = GroupedMapReduce (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3) instance P'.Default GroupedMapReduce where defaultValue = GroupedMapReduce P'.defaultValue P'.defaultValue P'.defaultValue instance P'.Wire GroupedMapReduce where wireSize ft' self'@(GroupedMapReduce x'1 x'2 x'3) = case ft' of 10 -> calc'Size 11 -> P'.prependMessageSize calc'Size _ -> P'.wireSizeErr ft' self' where calc'Size = (P'.wireSizeReq 1 11 x'1 + P'.wireSizeReq 1 11 x'2 + P'.wireSizeReq 1 11 x'3) wirePut ft' self'@(GroupedMapReduce x'1 x'2 x'3) = case ft' of 10 -> put'Fields 11 -> do P'.putSize (P'.wireSize 10 self') put'Fields _ -> P'.wirePutErr ft' self' where put'Fields = do P'.wirePutReq 10 11 x'1 P'.wirePutReq 18 11 x'2 P'.wirePutReq 26 11 x'3 wireGet ft' = case ft' of 10 -> P'.getBareMessageWith update'Self 11 -> P'.getMessageWith update'Self _ -> P'.wireGetErr ft' where update'Self wire'Tag old'Self = case wire'Tag of 10 -> Prelude'.fmap (\ !new'Field -> old'Self{group_mapping = P'.mergeAppend (group_mapping old'Self) (new'Field)}) (P'.wireGet 11) 18 -> Prelude'.fmap (\ !new'Field -> old'Self{value_mapping = P'.mergeAppend (value_mapping old'Self) (new'Field)}) (P'.wireGet 11) 26 -> Prelude'.fmap (\ !new'Field -> old'Self{reduction = P'.mergeAppend (reduction old'Self) (new'Field)}) (P'.wireGet 11) _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self instance P'.MessageAPI msg' (msg' -> GroupedMapReduce) GroupedMapReduce where getVal m' f' = f' m' instance P'.GPB GroupedMapReduce instance P'.ReflectDescriptor GroupedMapReduce where getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [10, 18, 26]) (P'.fromDistinctAscList [10, 18, 26]) reflectDescriptorInfo _ = Prelude'.read "DescriptorInfo {descName = ProtoName {protobufName = FIName \".Query_Language.Builtin.GroupedMapReduce\", haskellPrefix = [MName \"Database\",MName \"RethinkDB\",MName \"Internal\"], parentModule = [MName \"Query_Language\",MName \"Builtin\"], baseName = MName \"GroupedMapReduce\"}, descFilePath = [\"Database\",\"RethinkDB\",\"Internal\",\"Query_Language\",\"Builtin\",\"GroupedMapReduce.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Query_Language.Builtin.GroupedMapReduce.group_mapping\", haskellPrefix' = [MName \"Database\",MName \"RethinkDB\",MName \"Internal\"], parentModule' = [MName \"Query_Language\",MName \"Builtin\",MName \"GroupedMapReduce\"], baseName' = FName \"group_mapping\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Query_Language.Mapping\", haskellPrefix = [MName \"Database\",MName \"RethinkDB\",MName \"Internal\"], parentModule = [MName \"Query_Language\"], baseName = MName \"Mapping\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Query_Language.Builtin.GroupedMapReduce.value_mapping\", haskellPrefix' = [MName \"Database\",MName \"RethinkDB\",MName \"Internal\"], parentModule' = [MName \"Query_Language\",MName \"Builtin\",MName \"GroupedMapReduce\"], baseName' = FName \"value_mapping\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Query_Language.Mapping\", haskellPrefix = [MName \"Database\",MName \"RethinkDB\",MName \"Internal\"], parentModule = [MName \"Query_Language\"], baseName = MName \"Mapping\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Query_Language.Builtin.GroupedMapReduce.reduction\", haskellPrefix' = [MName \"Database\",MName \"RethinkDB\",MName \"Internal\"], parentModule' = [MName \"Query_Language\",MName \"Builtin\",MName \"GroupedMapReduce\"], baseName' = FName \"reduction\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Query_Language.Reduction\", haskellPrefix = [MName \"Database\",MName \"RethinkDB\",MName \"Internal\"], parentModule = [MName \"Query_Language\"], baseName = MName \"Reduction\"}), hsRawDefault = Nothing, hsDefault = Nothing}], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False}"