style: restructure cli and registry packages #43
@@ -33,7 +33,7 @@ func (b convertedProcess[T]) Set(r Repr) error {
|
||||
return b.process.Set(t)
|
||||
}
|
||||
|
||||
return fmt.Errorf("Incorrent format '%s' for engine '%s'.", r.Id(), b.inType)
|
||||
return fmt.Errorf("Incorrent format '%s' for engine '%s'.", r.ID(), b.inType)
|
||||
}
|
||||
|
||||
func (b convertedProcess[T]) Step(i int) bool {
|
||||
|
||||
@@ -44,7 +44,7 @@ func (r *Registry) GetDefaultEngine(id string) (Engine, error) {
|
||||
}
|
||||
|
||||
func (r *Registry) ConvertTo(repr Repr, outType string) (Repr, error) {
|
||||
path, err := r.ConversionPath(repr.Id(), outType)
|
||||
path, err := r.ConversionPath(repr.ID(), outType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -61,9 +61,9 @@ func (r *Registry) ConvertTo(repr Repr, outType string) (Repr, error) {
|
||||
}
|
||||
|
||||
func (r *Registry) Marshal(repr Repr) (string, error) {
|
||||
m, ok := r.marshalers[repr.Id()]
|
||||
m, ok := r.marshalers[repr.ID()]
|
||||
if !ok {
|
||||
return "", fmt.Errorf("no marshaler for '%s'", repr.Id())
|
||||
return "", fmt.Errorf("no marshaler for '%s'", repr.ID())
|
||||
}
|
||||
|
||||
return m.Encode(repr)
|
||||
|
||||
@@ -4,7 +4,7 @@ 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
|
||||
ID() string
|
||||
|
||||
Data() any
|
||||
}
|
||||
@@ -14,7 +14,7 @@ type baseRepr struct {
|
||||
data any
|
||||
}
|
||||
|
||||
func (r baseRepr) Id() string { return r.id }
|
||||
func (r baseRepr) ID() string { return r.id }
|
||||
|
||||
func (r baseRepr) Data() any { return r.data }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user