MCPcopy Index your code
hub / github.com/zalando/skipper / getStateBag

Function getStateBag

script/script.go:604–627  ·  view source on GitHub ↗
(f filters.FilterContext)

Source from the content-addressed store, hash-verified

602}
603
604func getStateBag(f filters.FilterContext) func(*lua.LState) int {
605 return func(s *lua.LState) int {
606 fld := s.ToString(-1)
607 res, ok := f.StateBag()[fld]
608 if !ok {
609 return 0
610 }
611 switch res := res.(type) {
612 case string:
613 s.Push(lua.LString(res))
614 case int:
615 s.Push(lua.LNumber(res))
616 case int64:
617 s.Push(lua.LNumber(res))
618 case float64:
619 s.Push(lua.LNumber(res))
620 case *lua.LTable:
621 s.Push(res) // load *lua.LTable as is
622 default:
623 return 0
624 }
625 return 1
626 }
627}
628
629func setStateBag(f filters.FilterContext) func(*lua.LState) int {
630 return func(s *lua.LState) int {

Callers 1

getContextValueFunction · 0.85

Calls 1

StateBagMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…