github.com/royge/pop@v4.13.1+incompatible/columns/readable_columns.go (about)

     1  package columns
     2  
     3  import (
     4  	"sort"
     5  	"strings"
     6  )
     7  
     8  // ReadableColumns represents a list of columns Pop is allowed to read.
     9  type ReadableColumns struct {
    10  	Columns
    11  }
    12  
    13  // SelectString returns the SQL column list part of the SELECT
    14  // query.
    15  func (c ReadableColumns) SelectString() string {
    16  	var xs []string
    17  	for _, t := range c.Cols {
    18  		xs = append(xs, t.SelectSQL)
    19  	}
    20  	sort.Strings(xs)
    21  	return strings.Join(xs, ", ")
    22  }