@@ -17,31 +17,31 @@ type CTE struct {
1717 Cycle CTECycle
1818}
1919
20- func (c CTE ) WriteSQL (ctx context.Context , w io.Writer , d bob.Dialect , start int ) ([]any , error ) {
21- w .Write ([] byte ( c .Name ) )
20+ func (c CTE ) WriteSQL (ctx context.Context , w io.StringWriter , d bob.Dialect , start int ) ([]any , error ) {
21+ w .WriteString ( c .Name )
2222 _ , err := bob .ExpressSlice (ctx , w , d , start , c .Columns , "(" , ", " , ")" )
2323 if err != nil {
2424 return nil , err
2525 }
2626
27- w .Write ([] byte ( " AS " ) )
27+ w .WriteString ( " AS " )
2828
2929 switch {
3030 case c .Materialized == nil :
3131 // do nothing
3232 break
3333 case * c .Materialized :
34- w .Write ([] byte ( "MATERIALIZED " ) )
34+ w .WriteString ( "MATERIALIZED " )
3535 case ! * c .Materialized :
36- w .Write ([] byte ( "NOT MATERIALIZED " ) )
36+ w .WriteString ( "NOT MATERIALIZED " )
3737 }
3838
39- w .Write ([] byte ( "(" ) )
39+ w .WriteString ( "(" )
4040 args , err := c .Query .WriteQuery (ctx , w , start )
4141 if err != nil {
4242 return nil , err
4343 }
44- w .Write ([] byte ( ")" ) )
44+ w .WriteString ( ")" )
4545
4646 searchArgs , err := bob .ExpressIf (ctx , w , d , start + len (args ), c .Search ,
4747 len (c .Search .Columns ) > 0 , "\n " , "" )
@@ -71,16 +71,16 @@ type CTESearch struct {
7171 Set string
7272}
7373
74- func (c CTESearch ) WriteSQL (ctx context.Context , w io.Writer , d bob.Dialect , start int ) ([]any , error ) {
74+ func (c CTESearch ) WriteSQL (ctx context.Context , w io.StringWriter , d bob.Dialect , start int ) ([]any , error ) {
7575 // [ SEARCH { BREADTH | DEPTH } FIRST BY column_name [, ...] SET search_seq_col_name ]
76- fmt .Fprintf ( w , "SEARCH %s FIRST BY " , c .Order )
76+ w . WriteString ( fmt .Sprintf ( "SEARCH %s FIRST BY " , c .Order ) )
7777
7878 args , err := bob .ExpressSlice (ctx , w , d , start , c .Columns , "" , ", " , "" )
7979 if err != nil {
8080 return nil , err
8181 }
8282
83- fmt .Fprintf ( w , " SET %s" , c .Set )
83+ w . WriteString ( fmt .Sprintf ( " SET %s" , c .Set ) )
8484
8585 return args , nil
8686}
@@ -93,16 +93,16 @@ type CTECycle struct {
9393 DefaultVal any
9494}
9595
96- func (c CTECycle ) WriteSQL (ctx context.Context , w io.Writer , d bob.Dialect , start int ) ([]any , error ) {
96+ func (c CTECycle ) WriteSQL (ctx context.Context , w io.StringWriter , d bob.Dialect , start int ) ([]any , error ) {
9797 //[ CYCLE column_name [, ...] SET cycle_mark_col_name [ TO cycle_mark_value DEFAULT cycle_mark_default ] USING cycle_path_col_name ]
98- w .Write ([] byte ( "CYCLE " ) )
98+ w .WriteString ( "CYCLE " )
9999
100100 args , err := bob .ExpressSlice (ctx , w , d , start , c .Columns , "" , ", " , "" )
101101 if err != nil {
102102 return nil , err
103103 }
104104
105- fmt .Fprintf ( w , " SET %s" , c .Set )
105+ w . WriteString ( fmt .Sprintf ( " SET %s" , c .Set ) )
106106
107107 markArgs , err := bob .ExpressIf (ctx , w , d , start + len (args ), c .SetVal ,
108108 c .SetVal != nil , " TO " , "" )
@@ -118,7 +118,7 @@ func (c CTECycle) WriteSQL(ctx context.Context, w io.Writer, d bob.Dialect, star
118118 }
119119 args = append (args , defaultArgs ... )
120120
121- fmt .Fprintf ( w , " USING %s" , c .Using )
121+ w . WriteString ( fmt .Sprintf ( " USING %s" , c .Using ) )
122122
123123 return args , nil
124124}
0 commit comments