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
# in myapp/ | |
import os | |
from pathlib import Path | |
from typing import Mapping, NamedTuple, Optional | |
from datetime import timedelta | |
class DbConfig(NamedTuple): | |
dbname: str |
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.effect.{Blocker, ContextShift, IO} | |
import doobie.util.testing.Analyzable | |
import doobie.util.transactor.Transactor | |
import org.scalactic.source | |
import org.scalatest.Succeeded | |
import org.scalatest.funspec.AsyncFunSpecLike | |
import scala.concurrent.{ExecutionContext, Future} | |
trait DoobieTest extends AsyncFunSpecLike with doobie.scalatest.IOChecker { |
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
package akkahttp4s | |
import akka.http.scaladsl.model.{ | |
ContentType, | |
ContentTypes, | |
HttpEntity, | |
HttpHeader, | |
HttpMethod, | |
HttpMethods, | |
HttpProtocol, |
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._ | |
import cats.implicits._ | |
import cats.effect._ | |
import scala.concurrent.duration._ | |
object ModDate { | |
def epochDay[F[_]: Clock: Functor]: F[Long] = | |
Clock[F] | |
.realTime(SECONDS) | |
.map(FiniteDuration(_, SECONDS).toDays) |
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.implicits._ | |
import cats.data.NonEmptyChain | |
import scala.xml.{Elem, Node} | |
object ScalaXmlUtils { | |
type XmlResult[A] = Either[NonEmptyChain[String], A] | |
/** Get the `<tagLabel>` child of `node` or fail */ | |
def get(node: Node, tagLabel: String): XmlResult[Node] = | |
getOpt(node, tagLabel) |
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.Eq | |
import cats.effect.{ContextShift, IO, Timer} | |
import org.scalactic.Prettifier | |
import org.scalactic.source.Position | |
import org.scalatest.exceptions.TestFailedException | |
import org.scalatest.{Assertion, AsyncTestSuite} | |
import scala.concurrent.Future | |
import scala.concurrent.duration._ | |
import scala.reflect.ClassTag |
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.Monad | |
import cats.effect.concurrent.{Ref, Semaphore} | |
import cats.effect.{Concurrent, Resource} | |
import cats.implicits._ | |
import fs2.{Pipe, Stream} | |
import fs2.concurrent.{NoneTerminatedQueue, Queue} | |
/** Represents the ability to enqueue keyed items into a stream of queues that emits homogenous keyed streams. | |
* |
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
// Copyright 2019-2021 github.com/daenyth | |
// Under the MIT license | |
/* | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNE |
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.implicits._ | |
import cats._ | |
import cats.effect.implicits._ | |
import cats.effect._ | |
import doobie._ | |
import doobie.implicits._ | |
import doobie.postgres._ | |
import java.io.{InputStream, OutputStream, PipedInputStream, PipedOutputStream} | |
import fs2.Stream |