libro-backend-0.1.0.0: Restful data backend of the LiBro app
Safe HaskellSafe-Inferred
LanguageHaskell2010

LiBro.Data.Storage

Description

LiBro data transformations for storage

Synopsis

Handling of multiple IDs in a single value

newtype IdList Source #

A thin wrapper around lists of Int with a simple (space-separated) String representation.

Constructors

IdList 

Fields

Instances

Instances details
Generic IdList Source # 
Instance details

Defined in LiBro.Data.Storage

Associated Types

type Rep IdList :: Type -> Type #

Methods

from :: IdList -> Rep IdList x #

to :: Rep IdList x -> IdList #

Read IdList Source # 
Instance details

Defined in LiBro.Data.Storage

Show IdList Source # 
Instance details

Defined in LiBro.Data.Storage

FromField IdList Source # 
Instance details

Defined in LiBro.Data.Storage

ToField IdList Source # 
Instance details

Defined in LiBro.Data.Storage

Methods

toField :: IdList -> Field #

Eq IdList Source # 
Instance details

Defined in LiBro.Data.Storage

Methods

(==) :: IdList -> IdList -> Bool #

(/=) :: IdList -> IdList -> Bool #

type Rep IdList Source # 
Instance details

Defined in LiBro.Data.Storage

type Rep IdList = D1 ('MetaData "IdList" "LiBro.Data.Storage" "libro-backend-0.1.0.0-inplace" 'True) (C1 ('MetaCons "IdList" 'PrefixI 'True) (S1 ('MetaSel ('Just "ids") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Int])))

idListToStr :: IdList -> String Source #

Simple String representation of an IdList: space-separated numbers.

strToIdList :: String -> IdList Source #

Reads space-separated Ints to an IdList.

Storable task records

data TaskRecord Source #

A data type specialized to store Task information in tables.

Instances

Instances details
Generic TaskRecord Source # 
Instance details

Defined in LiBro.Data.Storage

Associated Types

type Rep TaskRecord :: Type -> Type #

Show TaskRecord Source # 
Instance details

Defined in LiBro.Data.Storage

DefaultOrdered TaskRecord Source # 
Instance details

Defined in LiBro.Data.Storage

FromNamedRecord TaskRecord Source # 
Instance details

Defined in LiBro.Data.Storage

ToNamedRecord TaskRecord Source # 
Instance details

Defined in LiBro.Data.Storage

Eq TaskRecord Source # 
Instance details

Defined in LiBro.Data.Storage

type Rep TaskRecord Source # 
Instance details

Defined in LiBro.Data.Storage

taskRecordsToTasks :: Persons -> [TaskRecord] -> Tasks Source #

Load Tasks from TaskRecords. Needs to lookup Persons.

Top level data handling

storePersons :: Persons -> LiBro () Source #

Store Persons at the configured storage space

loadPersons :: LiBro Persons Source #

Load a list of Persons from the configured storage space. Returns empty data if no input file was found.

storeTasks :: Tasks -> LiBro () Source #

Store Tasks at the configured storage space.

loadTasks :: Persons -> LiBro Tasks Source #

Load Tasks from the configured storage space. Needs an additional Map to find Persons for given person ids (Int). Returns empty data if no input file was found.

storeData :: LiBroData -> LiBro () Source #

Store a complete dataset at the configured file system locations.

loadData :: LiBro LiBroData Source #

Load a complete dataset from the configured file system locations. Returns empty data if no input files were found.