IHP Api Reference
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 :: Symbol) 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, Table fetchModel) => Proxy field -> model -> IO (Include field model) Source #

collectionFetchRelated :: forall model (relatedField :: Symbol). (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 #

collectionFetchRelatedOrNothing :: forall model (relatedField :: Symbol). (CollectionFetchRelatedOrNothing relatedFieldValue relatedModel, ?modelContext :: ModelContext, HasField relatedField model (Maybe relatedFieldValue), UpdateField relatedField model (Include relatedField model) (Maybe relatedFieldValue) (Maybe (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 :: Symbol) 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, Table fetchModel) => Proxy field -> model -> IO (Include field model) Source #

maybeFetchRelatedOrNothing :: forall model (field :: Symbol) 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, Table fetchModel) => Proxy field -> Maybe model -> IO (Maybe (Include field model)) Source #