This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package aecor.testkit | |
import aecor.data.PairE | |
import aecor.encoding.WireProtocol | |
import aecor.encoding.WireProtocol.{ Encoded, Invocation } | |
import cats.data.ReaderT | |
import cats.tagless.FunctorK | |
import cats.tagless.implicits._ | |
import cats.~> | |
import scodec.bits.BitVector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package aecor.runtime.akkapersistence.readside | |
import aecor.data.{ EntityEvent, Fold, Folded } | |
import aecor.runtime.Eventsourced.Versioned | |
import cats.MonadError | |
import cats.implicits._ | |
object Projection { | |
final case class ProjectionError(message: String) extends RuntimeException(message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package aecor.kafkadistributedprocessing | |
import java.time.Duration | |
import java.util | |
import java.util.concurrent.Executors | |
import aecor.util.effect._ | |
import akka.NotUsed | |
import akka.kafka.ConsumerMessage.PartitionOffset | |
import akka.kafka.scaladsl.Consumer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.ActorSystem | |
import akka.kafka.scaladsl.Consumer | |
import akka.kafka.{ConsumerSettings, Subscriptions} | |
import akka.stream.ActorMaterializer | |
import akka.stream.scaladsl.{Keep, Sink => AkkaSink} | |
import cats.effect.{ConcurrentEffect, ExitCode, IO, Resource} | |
import cats.implicits._ | |
import fs2.interop.reactivestreams._ | |
import org.apache.kafka.common.serialization.StringDeserializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION auditlogfunc RETURNS TRIGGER AS $example_table$ | |
DECLARE | |
row_key JSONB; | |
affected_row JSON; | |
operation char; | |
BEGIN | |
IF TG_OP IN('INSERT', 'UPDATE') THEN | |
affected_row := row_to_json(NEW); | |
ELSE | |
affected_row := row_to_json(OLD); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.data.Kleisli | |
import cats.effect.{ Concurrent, Sync } | |
import cats.effect.concurrent.MVar | |
import cats.implicits._ | |
import cats.{ Applicative, Functor, Monad } | |
// Let's start with our dsl | |
// First we need to interact with a console | |
trait Console[F[_]] { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.{ Comonad, Monad } | |
import cats.effect.{ Concurrent, Resource, Timer } | |
import cats.implicits._ | |
import scala.concurrent.duration.FiniteDuration | |
object Ex { | |
final case class Point(x: Long, y: Long) | |
final case class Direction(value: Double) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package aecor.data | |
import aecor.data.ActionT.{ActionFailure, ActionResult} | |
import cats.data._ | |
import cats.implicits._ | |
import cats.{Applicative, Functor, Monad, ~>} | |
final class ActionT[F[_], S, E, R, A] private ( | |
val unsafeRun: (S, (S, E) => Folded[S], Chain[E]) => F[ActionResult[R, E, A]] | |
) extends AnyVal { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tagless Encoding | |
trait Counter[F[_]] { | |
def increment(value: Int): F[Unit] | |
def decrement(value: Int): F[Unit] | |
def value: F[Int] | |
} | |
// Free Encoding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.Applicative | |
import cats.effect.Sync | |
import com.evotor.common.logging.Logger.Level | |
import org.slf4j.LoggerFactory | |
import scala.reflect.ClassTag | |
trait Logger[F[_]] { | |
def log(level: Level.Value, msg: => String, throwable: Throwable): F[Unit] |
NewerOlder