github.com/duskeagle/pop@v4.10.1-0.20190417200916-92f2b794aab5+incompatible/columns/writeable_columns.go (about)

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