github.com/dkishere/pop@v4.13.1+incompatible/having.go (about)

     1  package pop
     2  
     3  import (
     4  	"strings"
     5  )
     6  
     7  // HavingClause defines a condition and its arguments for a HAVING clause
     8  type HavingClause struct {
     9  	Condition string
    10  	Arguments []interface{}
    11  }
    12  
    13  type havingClauses []HavingClause
    14  
    15  func (c HavingClause) String() string {
    16  	return c.Condition
    17  }
    18  
    19  func (c havingClauses) String() string {
    20  	if len(c) == 0 {
    21  		return ""
    22  	}
    23  
    24  	var cs []string
    25  	for _, cl := range c {
    26  		cs = append(cs, cl.String())
    27  	}
    28  	return strings.Join(cs, " AND ")
    29  }