NewValue makes gohan script value from an yaml data
(a interface{})
| 114 | |
| 115 | //NewValue makes gohan script value from an yaml data |
| 116 | func NewValue(a interface{}) (Value, error) { |
| 117 | if a == nil { |
| 118 | return nil, nil |
| 119 | } |
| 120 | miniGoValue, err := NewMiniGoValue(a) |
| 121 | if err != nil { |
| 122 | return nil, err |
| 123 | } |
| 124 | if miniGoValue != nil { |
| 125 | return miniGoValue, nil |
| 126 | } |
| 127 | if ContainsTemplate(a) { |
| 128 | return NewTemplate(a), nil |
| 129 | } |
| 130 | return &Constant{ |
| 131 | value: a, |
| 132 | }, nil |
| 133 | } |
| 134 | |
| 135 | //ApplyTemplate apply template code for input params. |
| 136 | func ApplyTemplate(template *Template, param interface{}, context *Context) (result interface{}) { |
no test coverage detected