github.com/tobgu/qframe@v0.4.0/internal/template/docs.go (about)

     1  package template
     2  
     3  import "bytes"
     4  
     5  const DocTemplate = `
     6  func Doc() string {
     7  	return "\n Built in filters\n" +
     8  {{ range $name := .filters }}"  {{$name}}\n" +
     9  {{ end }}
    10  "\n Built in aggregations\n" +
    11  {{ range $name := .aggregations }}"  {{$name}}\n" +
    12  {{ end }}"\n"
    13  }
    14  `
    15  
    16  func GenerateDocs(pkgName string, filters, aggregations []string) (*bytes.Buffer, error) {
    17  	values := map[string]interface{}{
    18  		"filters":      filters,
    19  		"aggregations": aggregations}
    20  
    21  	return Generate(pkgName, []Spec{{Name: "filterdocs", Template: DocTemplate, Values: values}}, []string{})
    22  }