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