Newer
Older
AlgebraicDataflowArchitectureModel / AlgebraicDataflowArchitectureModel / models / DataStore.model
Sakoda2269 21 days ago 1008 bytes modelファイル修正
channel addAccounts {
	out accounts(accounts: Map, addAccounts(id: Str, name: Str, age: Int)) = insert(accounts, id, {"name": name, "age": age})
}

channel changeAccountsName(id: Str) {
	out accounts.{id}.name(name: Str, changeAccountsName(newName: Str)) = newName
}

channel changeAccountsAge(id: Str) {
	out accounts.{id}.name(age: Int, channgeAccountsAge(newAge: Int)) = newAge
}

channel addTweets {
	ref accounts(accounts: Map, addTweets(accounts: Map, tweetId: Str, accountId: Str, contents: Str))
	out tweets(tweets: Map, addTweets(accounts, tweetId, accountId, contents)) 
	= if(contains(accounts, accountId),
			insert(tweets, tweetId, {"accountId": accountId, "contents": contents}),
			tweets)
}

channel changeTweetsAccountId(tweetId: Str) {
	out tweets.{tweetId}.accountId(accountId: Str, changeTweetsAccountId(newAccountId: Str)) = newAccountId
}

channel changeTweetsContents(tweetId: Str) {
	out tweets.{tweetId}.contents(contents: Str, changeTweetsContents(newContents: Str)) = newContents
}