コード例 #1
0
func (model *ReadModelAccounts) UpdateViewModelOnEmailAddressChangedEvent(accountID string, event EmailAddressChangedEvent) {
	if model.Accounts[accountID] == nil {
		log.Println(glr.Red("Could not find account with ID " + accountID))
		return
	}

	model.Accounts[accountID].EmailAddress = event.NewEmailAddress
}
コード例 #2
0
func (model *ReadModelAccounts) UpdateViewModelOnAccountDebitedEvent(accountID string, event AccountDebitedEvent) {
	if model.Accounts[accountID] == nil {
		log.Println(glr.Red("Could not find account with ID " + accountID))
		return
	}

	model.Accounts[accountID].Balance -= event.Amount
}
コード例 #3
0
ファイル: sample.go プロジェクト: logrusorgru/glr
func main() {
	Black := "Black"
	Red := "Red"
	Green := "Green"
	Brown := "Brown"
	Blue := "Blue"
	Magenta := "Magenta"
	Cyan := "Cyan"
	Gray := "Gray"
	BgBlack := "BgBlack"
	BgRed := "BgRed"
	BgGreen := "BgGreen"
	BgBrown := "BgBrown"
	BgBlue := "BgBlue"
	BgMagenta := "BgMagenta"
	BgCyan := "BgCyan"
	BgGray := "BgGray"
	Bold := "Bold"
	Reverse := "Reverse"

	fmt.Println(glr.Black(Black))
	fmt.Println(glr.Red(Red))
	fmt.Println(glr.Green(Green))
	fmt.Println(glr.Brown(Brown))
	fmt.Println(glr.Blue(Blue))
	fmt.Println(glr.Magenta(Magenta))
	fmt.Println(glr.Cyan(Cyan))
	fmt.Println(glr.Gray(Gray))
	fmt.Println(glr.BgBlack(BgBlack))
	fmt.Println(glr.BgRed(BgRed))
	fmt.Println(glr.BgGreen(BgGreen))
	fmt.Println(glr.BgBrown(BgBrown))
	fmt.Println(glr.BgBlue(BgBlue))
	fmt.Println(glr.BgMagenta(BgMagenta))
	fmt.Println(glr.BgCyan(BgCyan))
	fmt.Println(glr.BgGray(BgGray))
	fmt.Println(glr.Bold(Bold))
	fmt.Println(glr.Reverse(Reverse))

	fmt.Println(glr.Blue(glr.BgGreen("Blue and BgGreen")))

	fmt.Println(glr.Clear(glr.Blue(glr.BgGreen("Cleared: Blue and BgGreen"))))

}
コード例 #4
0
ファイル: glr_test.go プロジェクト: logrusorgru/glr
func TestRed(t *testing.T) {
	r := "\033[31mRed\033[0m"
	if s := glr.Red("Red"); s != r {
		t.Error("Expected '", r, "', got '", s, "'")
	}
}