github.com/dolthub/go-mysql-server@v0.18.0/sql/plan/str_expr.go (about)

     1  package plan
     2  
     3  import (
     4  	"github.com/dolthub/go-mysql-server/sql"
     5  	"github.com/dolthub/go-mysql-server/sql/transform"
     6  )
     7  
     8  // AliasSubqueryString returns a string with subquery expressions simplified into
     9  // static query strings, rather than the plan string (which is mutable through
    10  // analysis).
    11  func AliasSubqueryString(e sql.Expression) string {
    12  	e, _, err := transform.Expr(e, func(e sql.Expression) (sql.Expression, transform.TreeIdentity, error) {
    13  		switch e := e.(type) {
    14  		case *Subquery:
    15  			return NewSubquery(NewStrExpr(e.QueryString), e.QueryString), transform.NewTree, nil
    16  		default:
    17  			return e, transform.SameTree, nil
    18  		}
    19  	})
    20  	if err != nil {
    21  		panic(err)
    22  	}
    23  	return e.String()
    24  }
    25  
    26  // StrExpr is used exclusively for overriding the .String()
    27  // method of a node.
    28  type StrExpr struct {
    29  	s string
    30  }
    31  
    32  var _ sql.Node = (*StrExpr)(nil)
    33  
    34  func (s *StrExpr) Schema() sql.Schema {
    35  	//TODO implement me
    36  	panic("implement me")
    37  }
    38  
    39  func (s *StrExpr) Children() []sql.Node {
    40  	//TODO implement me
    41  	panic("implement me")
    42  }
    43  
    44  func (s *StrExpr) WithChildren(children ...sql.Node) (sql.Node, error) {
    45  	//TODO implement me
    46  	panic("implement me")
    47  }
    48  
    49  func (s *StrExpr) CheckPrivileges(ctx *sql.Context, opChecker sql.PrivilegedOperationChecker) bool {
    50  	//TODO implement me
    51  	panic("implement me")
    52  }
    53  
    54  func (s *StrExpr) IsReadOnly() bool {
    55  	//TODO implement me
    56  	panic("implement me")
    57  }
    58  
    59  func NewStrExpr(s string) *StrExpr {
    60  	return &StrExpr{s: s}
    61  }
    62  
    63  func (s *StrExpr) Resolved() bool {
    64  	//TODO implement me
    65  	panic("implement me")
    66  }
    67  
    68  func (s *StrExpr) String() string {
    69  	return s.s
    70  }
    71  
    72  func (s *StrExpr) Type() sql.Type {
    73  	//TODO implement me
    74  	panic("implement me")
    75  }
    76  
    77  func (s *StrExpr) IsNullable() bool {
    78  	//TODO implement me
    79  	panic("implement me")
    80  }
    81  
    82  func (s *StrExpr) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
    83  	//TODO implement me
    84  	panic("implement me")
    85  }