MCPcopy Create free account
hub / github.com/cloudwan/gohan / LoadString

Method LoadString

extension/gohanscript/vm.go:91–106  ·  view source on GitHub ↗

LoadString loads gohan script code from string and make func

(fileName, yamlString string)

Source from the content-addressed store, hash-verified

89
90//LoadString loads gohan script code from string and make func
91func (vm *VM) LoadString(fileName, yamlString string) error {
92 code, err := LoadYAML([]byte(yamlString))
93 if err != nil {
94 return err
95 }
96 main, err := NewStmt(fileName, code)
97 if err != nil {
98 return err
99 }
100 fun, err := main.Func()
101 if err != nil {
102 return err
103 }
104 vm.funcs = append(vm.funcs, fun)
105 return nil
106}
107
108//Run executes loaded funcs
109func (vm *VM) Run(data map[string]interface{}) error {

Callers 2

httpServerFunction · 0.95
LoadExtensionsForPathMethod · 0.80

Calls 3

FuncMethod · 0.95
LoadYAMLFunction · 0.85
NewStmtFunction · 0.85

Tested by

no test coverage detected