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
- vSelect :: (HasCallStack, HasRecordId r, Show a) => Table a -> r -> a
- selectMaybe :: HasRecordId r => Table a -> r -> Maybe (Record a)
- vSelectMaybe :: HasRecordId r => Table a -> r -> Maybe a
- selectAll :: Table a -> [Record a]
- vSelectAll :: Table a -> [a]
- selectAllKeys :: Table a -> [RecordID]
- selectWhere :: Table a -> (Record a -> Bool) -> [Record a]
- vSelectWhere :: Table a -> (a -> Bool) -> [a]
- selectKeyWhere :: Table a -> (Record a -> Bool) -> [RecordID]
- vSelectKeyWhere :: Table a -> (a -> Bool) -> [RecordID]
- deleteWhere :: Table a -> (Record a -> Bool) -> Table a
- vDeleteWhere :: Table a -> (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.
vSelect :: (HasCallStack, HasRecordId r, Show a) => Table a -> r -> a Source #
Same as select
, but returns the record object.
selectMaybe :: HasRecordId r => Table a -> r -> Maybe (Record a) Source #
Safely lookup a record using its RecordID.
vSelectMaybe :: HasRecordId r => Table a -> r -> Maybe a Source #
Same as selectMaybe
, but returns the record object.
vSelectAll :: Table a -> [a] Source #
Same as selectAll
, but returns the record object.
selectAllKeys :: Table a -> [RecordID] Source #
Read all RecordID's.
selectWhere :: Table a -> (Record a -> Bool) -> [Record a] Source #
Select all records satisfying a condition.
vSelectWhere :: Table a -> (a -> Bool) -> [a] Source #
Same as selectWhere
, but returns the record object.
selectKeyWhere :: Table a -> (Record a -> Bool) -> [RecordID] Source #
Select all records satisfying a condition.
vSelectKeyWhere :: Table a -> (a -> Bool) -> [RecordID] Source #
Same as selectKeyWhere
, but returns the record object.
deleteWhere :: Table a -> (Record a -> Bool) -> Table a Source #
Delete all Records satisfying a condition.
vDeleteWhere :: Table a -> (a -> Bool) -> Table a Source #
Same as deleteWhere
, but returns the record object.