Copyright(c) digitally induced GmbH 2020
Safe HaskellNone

IHP.FetchRelated

Description

This modules provides helper functions to access relationshops for a model.

See https://ihp.digitallyinduced.com/Guide/relationships.html for some examples.

Documentation

fetchRelated :: forall model field fieldValue fetchModel. (?modelContext :: ModelContext, UpdateField field model (Include field model) fieldValue (FetchResult fieldValue fetchModel), HasField field model fieldValue, FromRow fetchModel, KnownSymbol (GetTableName fetchModel), Fetchable fieldValue fetchModel) => Proxy field -> model -> IO (Include field model) Source #

collectionFetchRelated :: forall model relatedField. (CollectionFetchRelated relatedFieldValue relatedModel, ?modelContext :: ModelContext, HasField relatedField model relatedFieldValue, UpdateField relatedField model (Include relatedField model) relatedFieldValue (FetchResult relatedFieldValue relatedModel), Fetchable relatedFieldValue relatedModel, KnownSymbol (GetTableName relatedModel), FromRow relatedModel, KnownSymbol relatedField) => Proxy relatedField -> [model] -> IO [Include relatedField model] Source #

fetchRelatedOrNothing :: forall model field fieldValue fetchModel. (?modelContext :: ModelContext, UpdateField field model (Include field model) (Maybe fieldValue) (Maybe (FetchResult fieldValue fetchModel)), HasField field model (Maybe fieldValue), FromRow fetchModel, KnownSymbol (GetTableName fetchModel), Fetchable fieldValue fetchModel) => Proxy field -> model -> IO (Include field model) Source #

maybeFetchRelatedOrNothing :: forall model field fieldValue fetchModel. (?modelContext :: ModelContext, UpdateField field model (Include field model) (Maybe fieldValue) (Maybe (FetchResult fieldValue fetchModel)), HasField field model (Maybe fieldValue), FromRow fetchModel, KnownSymbol (GetTableName fetchModel), Fetchable fieldValue fetchModel) => Proxy field -> Maybe model -> IO (Maybe (Include field model)) Source #