bib.yml
に参考文献情報を記載する- カスタムインライン命令
@<bibinfo>{id}
で参考文献情報を展開できるようにする。review-ext.rb
は認識される場所に配置してください。 ruby generate-bib-re.rb bib.yml bib.re
などとしてbib.yml
からbib.re
を生成する
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
-- Domain/UserAccount.hs | |
module Domain.UserAccount where | |
data UserAccount = UserAccount | |
{ accountId :: Int | |
, username :: String | |
, email :: String | |
} deriving (Show) | |
data UserAccountEvent |
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
use std::fmt::Debug; | |
use async_trait::async_trait; | |
use std::future::Future; | |
use std::pin::Pin; | |
use std::sync::Arc; | |
// 既存のインポートはそのまま維持 | |
type BehaviorFn<M> = Box<dyn Fn(M, &mut ActorContext<M>) -> Pin<Box<dyn Future<Output = Behavior<M>> + Send>> + Send + Sync>; |
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
// ここでいうステートレスというのはアプリケーションに状態があるのではなく、DBに状態があることを意味しています。 | |
// 逆にAkka Clusterで実装されるEvent Sourcingシステムでは、アプリケーションの状態はアプリケーションが保持しており、 | |
// DBはバックアップログを持つストレージの役割になります。 | |
pub struct EventPersistenceGateway<'a> { | |
journal_table_name: String, | |
snapshot_table_name: String, | |
client: &'a Client, | |
} |
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
// https://github.com/fpinscala/fpinscala/.../parsing/Parsers.scala の一部 | |
extension [A](p: Parser[A]) | |
// 中略 | |
def opt: Parser[Option[A]] = p.map(Some(_)) | succeed(None) | |
def map[B](f: A => B): Parser[B] = p.flatMap(f andThen succeed) | |
def |(p2: => Parser[A]): Parser[A] = p.or(p2) |
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
/* | |
* Copyright 2022 Junichi Kato | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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 java.util.Currency | |
final case class Money(amount: BigDecimal, currency: Currency) | |
object Money { | |
implicit object MoneyAdder extends Adder[Money] { | |
override type Output = Either[Exception, Money] |
State Sourcing(CRUD)
なら以下のようなイメージ。まぁ普通によく見るロジック。
class AddCartItemCommandProcessorOnSS(cartRepository: CartRepository) {
def execute(cartId: CartId, itemId: ItemId, num: ItemNum): Unit = {
// 最新の集約(グローバルなエンティティ)をストレージから取得する
val cart = cartRepository.findById(cartId)
// ロジック実行: 予算超過ならカートオブジェクトが商品の追加を拒否する! (1)
val newCart = cart.addItem(itemId, num)
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
pub struct ToyVec<T> { | |
elements: Box<[T]>, | |
len: usize, | |
} | |
pub struct Iter<'vec, T> { | |
// 参照型のフィールドにはライフタイム指定子 | |
elements: &'vec Box<[T]>, | |
len: usize, | |
pos: usize, |
NewerOlder