package state import "go.uber.org/zap/zapcore" // UserData contains data about clients that is synced between client and server. // Unlike the map, UserData is not persisted to disk, and all UserData is lost on shutdown. type UserData struct { ActiveColor HexColor `json:"activeColor"` } func (u UserData) MarshalLogObject(encoder zapcore.ObjectEncoder) error { encoder.AddString("activeColor", u.ActiveColor.String()) return nil } // Copy creates a deep copy of this UserData. func (u UserData) Copy() UserData { return UserData{ ActiveColor: u.ActiveColor, } }