feat: rename repr to expr
This commit is contained in:
@@ -40,16 +40,18 @@ func (r *Registry) GetDefaultEngine(id string) (Engine, error) {
|
||||
}
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("no engine for '%s'", id)
|
||||
return r.GetEngine("normalorder")
|
||||
|
||||
// return nil, fmt.Errorf("no engine for '%s'", id)
|
||||
}
|
||||
|
||||
func (r *Registry) ConvertTo(repr Repr, outType string) (Repr, error) {
|
||||
path, err := r.ConversionPath(repr.ID(), outType)
|
||||
func (r *Registry) ConvertTo(expr Expr, outType string) (Expr, error) {
|
||||
path, err := r.ConversionPath(expr.Repr(), outType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := repr
|
||||
result := expr
|
||||
for _, conversion := range path {
|
||||
result, err = conversion.Run(result)
|
||||
if err != nil {
|
||||
@@ -60,16 +62,16 @@ func (r *Registry) ConvertTo(repr Repr, outType string) (Repr, error) {
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (r *Registry) Marshal(repr Repr) (string, error) {
|
||||
m, ok := r.codecs[repr.ID()]
|
||||
func (r *Registry) Marshal(expr Expr) (string, error) {
|
||||
m, ok := r.codecs[expr.Repr()]
|
||||
if !ok {
|
||||
return "", fmt.Errorf("no marshaler for '%s'", repr.ID())
|
||||
return "", fmt.Errorf("no marshaler for '%s'", expr.Repr())
|
||||
}
|
||||
|
||||
return m.Encode(repr)
|
||||
return m.Encode(expr)
|
||||
}
|
||||
|
||||
func (r *Registry) Unmarshal(s string, outType string) (Repr, error) {
|
||||
func (r *Registry) Unmarshal(s string, outType string) (Expr, error) {
|
||||
m, ok := r.codecs[outType]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("no marshaler for '%s'", outType)
|
||||
|
||||
Reference in New Issue
Block a user