File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/main/scala/com/intenthq/action_processor/integrations/feeds Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import cats.effect.IO
6
6
7
7
trait Feed [I , O ] {
8
8
9
+ def toString (i : I ): String = i.toString
10
+
9
11
lazy val feedName : String = getClass.getSimpleName.stripSuffix(" $" )
10
12
def date (feedContext : FeedContext [IO ], clock : Clock = Clock .systemDefaultZone()): IO [LocalDate ] =
11
13
feedContext.filter.date.fold(IO .delay(java.time.LocalDate .now(clock)))(IO .pure)
@@ -14,9 +16,10 @@ trait Feed[I, O] {
14
16
def inputStream (feedContext : FeedContext [IO ]): fs2.Stream [IO , I ]
15
17
def transform (feedContext : FeedContext [IO ]): fs2.Pipe [IO , I , (O , Long )]
16
18
def serialize (o : O , counter : Long ): Array [Byte ]
19
+ val serialization : fs2.Pipe [IO , (O , Long ), Array [Byte ]] = _.map((serialize _).tupled)
17
20
18
- final def stream (feedContext : FeedContext [IO ]): fs2.Stream [IO , Array [Byte ]] =
21
+ def stream (feedContext : FeedContext [IO ]): fs2.Stream [IO , Array [Byte ]] =
19
22
inputStream(feedContext)
20
23
.through(transform(feedContext))
21
- .map((serialize _).tupled )
24
+ .through(serialization )
22
25
}
You can’t perform that action at this time.
0 commit comments