SpieleLaden-NoSQL/src/util/structs.go

26 lines
715 B
Go
Raw Normal View History

2024-03-04 10:03:40 +01:00
package util
import (
"go.mongodb.org/mongo-driver/bson/primitive"
"time"
)
type Person struct {
ID primitive.ObjectID `bson:"_id,omitempty"`
Name string `bson:"name"`
Age int `bson:"age,omitempty" json:"age,omitempty"`
Email string `bson:"email,omitempty" json:"email,omitempty"`
}
type Debt struct {
ID primitive.ObjectID `bson:"_id,omitempty"`
PersonID primitive.ObjectID `bson:"fk_pid"`
Amount int `bson:"amount"`
Description string `bson:"description,omitempty"`
Datetime time.Time `bson:"datetime"`
}
type PersonWithDebts struct {
Person Person `json:"person"`
Debts []Debt `json:"debts"`
}