DataSourceMapper
DataSourceMapper<In,Out>
encapuslates a DataSource
instance of type In
and exposes a new interface of DataSource
of type Out
, mapping the objects using a Mapper<In,Out>
and Mapper<Out,In>
.
Usage
- Kotlin
- Swift
- TypeScript
- PHP
val dataSource = InMemoryDataSource<String, A>()val dataSourceMapper = DataSourceMapper(dataSource, dataSource, dataSource, AtoBMapper(), BtoAMapper()) dataSourceMapper.put("myKey", B())dataSourceMapper.get("myKey")
Query Types
Any Query
can be passed to a DataSourceMapper<In,Out>
.
Other Implementations
Together with DataSourceMapper<In,Out>
there are also similar implementations for:
GetDataSourceMapper<In,Out>
: ImplementsGetDataSource
.PutDataSourceMapper<In,Out>
: ImplementsPutDataSource
.
There is no need to map a DeleteDataSource
.