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
FROM golang:alpine as builder | |
COPY . . | |
RUN apk update && \ | |
apk upgrade && \ | |
apk add --no-cache ca-certificates && \ | |
apk add --update-cache tzdata && \ | |
update-ca-certificates | |
RUN echo "nobody:x:65534:65534:nobody:/:" > /etc_passwd | |
ENV GO111MODULE=on | |
ENV CGO_ENABLED=0 |
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
case class Pack(orders: Seq[Order], orderItems: Seq[OrderItem], products: Seq[Product]) | |
// 1. for-comprehension에서 flatMap 체이닝: 순서대로 실행된다. | |
for { | |
orders <- orderRepository.findAll() | |
orderItems <- orderItemRepository.findAll() | |
products <- productRepository.findAll() | |
} yield Pack(orders, orderItems, products) | |
// 2. future를 먼저 받아놓고 flatMap 체이닝: 동시에 여러 개의 Future를 진행할 수 있지만, 코드가 많아진다. |
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
export function combination<T>(xs: T[]): Array<Array<T>> { | |
return Array.from({ length: 2 ** xs.length }).map((_, i) => | |
xs.filter((_, j) => (i >>> j) & 1) | |
) | |
} |