You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-library/vendor/github.com/upper/db/v4/internal/sqladapter/exql/returning.go

36 lines
750 B

package exql
// Returning represents a RETURNING clause.
type Returning struct {
*Columns
hash hash
}
// Hash returns a unique identifier for the struct.
func (r *Returning) Hash() string {
return r.hash.Hash(r)
}
var _ = Fragment(&Returning{})
// ReturningColumns creates and returns an array of Column.
func ReturningColumns(columns ...Fragment) *Returning {
return &Returning{Columns: &Columns{Columns: columns}}
}
// Compile transforms the clause into its equivalent SQL representation.
func (r *Returning) Compile(layout *Template) (compiled string, err error) {
if z, ok := layout.Read(r); ok {
return z, nil
}
compiled, err = r.Columns.Compile(layout)
if err != nil {
return "", err
}
layout.Write(r, compiled)
return
}