package domain import ( "time" "uuid" ) type User struct { ID uuid.UUID Username string DisplayName string CreatedAt time.Time } type Chat struct { ID uuid.UUID Title string MemberIDs []uuid.UUID CreatedAt time.Time } func (c Chat) HasMember(userID uuid.UUID) bool { for _, id := range c.MemberIDs { if id == userID { return true } } return false } type Message struct { ID uuid.UUID ChatID uuid.UUID SenderID uuid.UUID Text string CreatedAt time.Time } type Session struct { Token string ExpiresAt time.Time User User } type Cursor struct { Scope uuid.UUID CreatedAt time.Time ID uuid.UUID } func CompareKey(aTime time.Time, aID uuid.UUID, bTime time.Time, bID uuid.UUID) int { if c := aTime.Compare(bTime); c != 0 { return c } return aID.Compare(bID) } type Page[T any] struct { Items []T Next *Cursor }