22 lines
445 B
Go
22 lines
445 B
Go
package cli
|
|
|
|
type Repr interface {
|
|
// Id returns to name of the objects underlying representation. If is
|
|
// assumed that if two Repr objects have the same Id(), they share the same
|
|
// representation.
|
|
Id() string
|
|
|
|
Data() any
|
|
}
|
|
|
|
type baseRepr struct {
|
|
id string
|
|
data any
|
|
}
|
|
|
|
func (r baseRepr) Id() string { return r.id }
|
|
|
|
func (r baseRepr) Data() any { return r.data }
|
|
|
|
func NewRepr(id string, data any) Repr { return baseRepr{id, data} }
|