Skip to content
Snippets Groups Projects
Commit 1d421a1e authored by Martin Schmollinger's avatar Martin Schmollinger
Browse files

Added domain types

parent 4fcff05c
No related branches found
No related tags found
No related merge requests found
package main
import (
"fmt"
"gitlab.reutlingen-university.de/go-exercises/myaktion-go/src/myaktion/model"
)
func main() {
c := model.Campaign{
Name: "Kinder helfen",
OrganizerName: "Hans Schmidt",
TargetAmount: 10000.0,
DonationMinimum: 10.0,
Account: model.Account{
Name: "Kinder helfen",
BankName: "Raiffeisen",
Number: "1234567890",
},
}
c.Donations = append(c.Donations, model.Donation{
Amount: 100.0,
DonorName: "Hans Muster",
ReceiptRequested: true,
Status: model.IN_PROCESS,
Account: model.Account{
Name: "Hans Muster",
BankName: "Raiffeisen",
Number: "1234567890",
},
})
fmt.Printf("%+v\n", c)
}
package model
type Account struct {
Name string
BankName string
Number string
}
package model
type Campaign struct {
Name string
OrganizerName string
TargetAmount float64
DonationMinimum float64
AmountDonatedSoFar float64
Donations []Donation
Account Account
}
package model
type Status string
const (
TRANSFERRED Status = "TRANSFERRED"
IN_PROCESS Status = "IN_PROCESS"
)
type Donation struct {
Amount float64
DonorName string
ReceiptRequested bool
Account Account
Status Status
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment