This file contains hidden or 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 os | |
import json | |
import logging | |
from urllib import request, parse | |
import pymysql | |
token = os.environ['TOKEN'] | |
rds_host = os.environ['RDS_HOST'] | |
name = os.environ['NAME'] | |
password = os.environ['PASSWORD'] |
This file contains hidden or 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 os | |
import json | |
import logging | |
from urllib import request, parse | |
token = os.environ['TOKEN'] | |
logger = logging.getLogger() | |
logger.setLevel(logging.INFO) |
This file contains hidden or 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 json | |
import logging | |
logger = logging.getLogger() | |
logger.setLevel(logging.INFO) | |
def lambda_handler(event, context): | |
logger.info(json.dumps(event)) | |
if ('challenge' in event): | |
return { |
This file contains hidden or 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 json | |
import logging | |
logger = logging.getLogger() | |
logger.setLevel(logging.INFO) | |
def lambda_handler(event, context): | |
logger.info(json.dumps(event)) | |
if ('challenge' in event): | |
return { |
This file contains hidden or 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
/* | |
<build.sbt> | |
scalaVersion := "2.13.0" | |
libraryDependencies ++= Seq( | |
"com.sksamuel.avro4s" %% "avro4s-core" % "3.0.1", | |
"eu.timepit" %% "refined" % "0.9.9", | |
"io.scalaland" %% "chimney" % "0.3.2" | |
) | |
<plugins.sbt> |
This file contains hidden or 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.free.Free | |
import cats.free.Free.liftF | |
import cats.~> | |
// domain layer ----------------------------------------------------------- | |
case class Movie(id: Int, title: String) | |
sealed trait Query[A] | |
case class GetMovie(id: Int) extends Query[Option[Movie]] |
This file contains hidden or 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.free.Free | |
import cats.free.Free.liftF | |
import cats.{Id, Monad, ~>} | |
import cats.syntax.option._ | |
// domain layer ----------------------------------------------------------- | |
case class Movie(id: Int, title: String) | |
sealed trait Query[A] | |
case class GetMovie(id: Int) extends Query[Option[Movie]] |
This file contains hidden or 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.free.Free | |
import cats.free.Free.liftF | |
import cats.~> | |
// domain layer ----------------------------------------------------------- | |
case class Movie(id: Int, title: String) | |
sealed trait Query[A] | |
case class GetMovie(id: Int) extends Query[Option[Movie]] |
This file contains hidden or 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.Chain | |
// domain layer ----------------------------------------------------------- | |
case class Movie(id: Int, title: String) | |
trait MovieRepo[F[_]] { | |
def getMovie(id: Int): F[Option[Movie]] | |
} | |
trait UsesMovieRepo[F[_]] { | |
val movieRepo: MovieRepo[F] |
This file contains hidden or 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.{Id, Monad} | |
// domain layer ------------------------------------------------------ | |
case class Movie(id: Int, title: String) | |
trait MovieRepoSym[F[_]] { | |
def getMovie(id: Int): F[Option[Movie]] | |
} | |
class MovieService[F[_]: Monad](sym: MovieRepoSym[F]) { |