...

Source file src/github.com/vektah/gqlparser/v2/ast/comment.go

Documentation: github.com/vektah/gqlparser/v2/ast

     1  package ast
     2  
     3  import (
     4  	"strconv"
     5  	"strings"
     6  )
     7  
     8  type Comment struct {
     9  	Value    string
    10  	Position *Position
    11  }
    12  
    13  func (c *Comment) Text() string {
    14  	return strings.TrimPrefix(c.Value, "#")
    15  }
    16  
    17  type CommentGroup struct {
    18  	List []*Comment
    19  }
    20  
    21  func (c *CommentGroup) Dump() string {
    22  	if len(c.List) == 0 {
    23  		return ""
    24  	}
    25  	var builder strings.Builder
    26  	for _, comment := range c.List {
    27  		builder.WriteString(comment.Value)
    28  		builder.WriteString("\n")
    29  	}
    30  	return strconv.Quote(builder.String())
    31  }
    32  

View as plain text