github.com/eden-framework/sqlx@v0.0.2/builder/addition_comment.go (about)

     1  package builder
     2  
     3  import (
     4  	"context"
     5  )
     6  
     7  type CommentAddition struct {
     8  }
     9  
    10  func (CommentAddition) AdditionType() AdditionType {
    11  	return AdditionComment
    12  }
    13  
    14  func Comment(c string) *comment {
    15  	return &comment{text: []byte(c)}
    16  }
    17  
    18  var _ Addition = (*comment)(nil)
    19  
    20  type comment struct {
    21  	CommentAddition
    22  
    23  	text []byte
    24  }
    25  
    26  func (c *comment) IsNil() bool {
    27  	return c == nil || len(c.text) == 0
    28  }
    29  
    30  func (c *comment) Ex(ctx context.Context) *Ex {
    31  	e := Expr("")
    32  	e.WhiteComments(c.text)
    33  	return e.Ex(ctx)
    34  }