Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Record a = Record {
- recordId :: RecordID
- recordObj :: a
- createdTime :: UTCTime
- newtype RecordID = RecordID Text
- rec2str :: RecordID -> String
- class HasRecordId a where
- data Table a = Table {
- tableRecords :: HashMap RecordID (Record a)
- tableOffset :: Maybe Text
- type TableName = String
- fromRecords :: [Record a] -> Table a
- fromList :: [(RecordID, Record a)] -> Table a
- toList :: Table a -> [(RecordID, Record a)]
- exists :: HasRecordId r => Table a -> r -> Bool
- select :: (HasCallStack, HasRecordId r, Show a) => Table a -> r -> Record a
- selectMaybe :: HasRecordId r => Table a -> r -> Maybe (Record a)
- selectAll :: Table a -> [Record a]
- selectAllKeys :: Table a -> [RecordID]
- selectWhere :: Table a -> (Record a -> Bool) -> [Record a]
- selectKeyWhere :: Table a -> (Record a -> Bool) -> [RecordID]
- deleteWhere :: Table a -> (Record a -> Bool) -> Table a
Record
An airtable record.
Functor Record Source # | |
Eq a => Eq (Record a) Source # | |
Ord a => Ord (Record a) Source # | |
Read a => Read (Record a) Source # | |
Show a => Show (Record a) Source # | |
Generic (Record a) Source # | |
ToJSON a => ToJSON (Record a) Source # | |
FromJSON a => FromJSON (Record a) Source # | |
HasRecordId (Record a) Source # | |
type Rep (Record a) Source # | |
RecordID
Airtable's record ID for use in indexing records
HasRecordId class
class HasRecordId a where Source #
A convenience typeclass for selecting records using RecordID-like keys.
Table
An airtable table.
Table | |
|
Table methods
fromList :: [(RecordID, Record a)] -> Table a Source #
Create a table from a list of key-record pairs.
exists :: HasRecordId r => Table a -> r -> Bool Source #
Check if a record exists at the given key in a table.
select :: (HasCallStack, HasRecordId r, Show a) => Table a -> r -> Record a Source #
Unsafely lookup a record using its RecordID. Will throw a pretty-printed error if record does not exist.
selectMaybe :: HasRecordId r => Table a -> r -> Maybe (Record a) Source #
Safely lookup a record using its RecordID.
selectAllKeys :: Table a -> [RecordID] Source #
Read all RecordID's.
selectWhere :: Table a -> (Record a -> Bool) -> [Record a] Source #
Select all records satisfying a condition.