MCPcopy Create free account
hub / github.com/araddon/qlbridge / FromExpr

Method FromExpr

expr/node.go:1868–1892  ·  view source on GitHub ↗
(e *Expr)

Source from the content-addressed store, hash-verified

1866 return fe
1867}
1868func (m *IncludeNode) FromExpr(e *Expr) error {
1869 if e.Op == "" {
1870 return fmt.Errorf("Invalid IncludeNode %+v", e)
1871 }
1872 m.Operator = lex.TokenFromOp(e.Op)
1873 if m.Operator.T == lex.TokenNil {
1874 return fmt.Errorf("Unrecognized op %v", e.Op)
1875 }
1876 if len(e.Args) == 0 {
1877 return fmt.Errorf("Invalid IncludeNode, expected 1 args %+v", e)
1878 }
1879 if len(e.Args) > 1 {
1880 return fmt.Errorf("Invalid IncludeNode, expected 1 args %+v", e)
1881 }
1882 arg, err := NodeFromExpr(e.Args[0])
1883 if err != nil {
1884 return err
1885 }
1886 in, ok := arg.(*IdentityNode)
1887 if !ok {
1888 return fmt.Errorf("Invalid IncludeNode, expected 1 Identity %+v", e)
1889 }
1890 m.Identity = in
1891 return nil
1892}
1893func (m *IncludeNode) Equal(n Node) bool {
1894 if m == nil && n == nil {
1895 return true

Callers

nothing calls this directly

Calls 3

TokenFromOpFunction · 0.92
NodeFromExprFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected