// Returning adds a RETURNING clause to the statement.
17758
func (stmt RetInsertStmt) Returning(cs ...aspect.Selectable) RetInsertStmt {
	// TODO An INSERT ... RETURING for all columns of the inserted row can
	// also use the syntax RETURNING *, see:
	// http://www.postgresql.org/docs/devel/static/sql-insert.html
	for _, selection := range cs {
		if selection == nil {
			stmt.SetError(
				"postgres: received a nil selectable in Returning() - do the columns or tables you selected exist?",
			)
			return stmt
		}

		// All selected columns must belong to the INSERT table
		for _, column := range selection.Selectable() {
			if column.Table() != stmt.Table() {
				stmt.SetError(
					"postgres: the column '%s' in Returning() does not belong to the inserted table '%s'",
					column.Name(), stmt.Table().Name(),
				)
				break
			}
			stmt.returning = append(stmt.returning, column)
		}
	}

	return stmt
}
401049
func (ix *Reindexer) Query(q Query) *Reindexer {
	ix.query = q
	return ix
}
187672
func (b *RouteBuilder) ReturnsError(code int, message string, model interface{}) *RouteBuilder {
	log.Print("ReturnsError is deprecated, use Returns instead.")
	return b.Returns(code, message, model)
}
945430
func (statement *Statement) Select(str string) *Statement {
	statement.selectStr = str
	return statement
}
1345646
func Query(q string) func(r *Rego) {
	return func(r *Rego) {
		r.query = q
	}
}
570417
func (statement *Statement) Or(query interface{}, args ...interface{}) *Statement {
	switch query.(type) {
	case string:
		cond := builder.Expr(query.(string), args...)
		statement.cond = statement.cond.Or(cond)
	case map[string]interface{}:
		cond := builder.Eq(query.(map[string]interface{}))
		statement.cond = statement.cond.Or(cond)
	case builder.Cond:
		cond := query.(builder.Cond)
		statement.cond = statement.cond.Or(cond)
		for _, v := range args {
			if vv, ok := v.(builder.Cond); ok {
				statement.cond = statement.cond.Or(vv)
			}
		}
	default:
		// TODO: not support condition type
	}
	return statement
}
1246720
func (bf *BufferFactory) ReturnBuffer(buf *bytes.Buffer) {
	bf.Return(buf.Bytes())
}
932618
func (r Returns) AsReturnSignature() string {
	if len(r) == 0 {
		return ""
	}
	if len(r) == 1 {
		return r[0].Type
	}
	result := "("
	for i := range r {
		result = result + r[i].Type
		if i < len(r) {
			result = result + ", "
		}
	}
	result = result + ")"
	return result
}
128620
func (f *MockFunction) ReturnToArgument(n int, v interface{}) *MockFunction {
	f.ReturnToArguments = append(f.ReturnToArguments, MockReturnToArgument{n, v})
	return f
}
894217
func (c *ConnectToken) ReturnCode() byte {
	c.m.RLock()
	defer c.m.RUnlock()
	return c.returnCode
}
1345579
func (p *ReadBuffer) Return(buf *buffer.Read) {
	p.pool.Return(buf)
}
942327
func (session *Session) Select(str string) *Session {
	session.statement.Select(str)
	return session
}
967052
func Encoding(encoding wire.MessageEncoding) QueryOption {
	return func(qo *queryOptions) {
		qo.encoding = encoding
	}
}
1316468
func (r *Recycle) Return(item Recycler) {
	// Recycle the item to ensure that a dirty instance is never offered
	// from Take. The call is done here so that the CPU cycles spent
	// clearing the buffer are owned by the caller, and not by the queue
	// itself. This makes the queue more likely to be available to deliver
	// items in the free list.
	item.Recycle()

	r.queue.Return(item)
}
1115315
func (builder *Builder) Returning(field string) *Builder {
	builder.returnField = field
	return builder
}
384287
func (db DBWrapper) Query(sqlText string, args ...interface{}) (qr QueryResult) {
	rows, err := db.DB.Query(sqlText, args...)
	defer func() {
		if rows != nil {
			rows.Close()
		}
	}()

	if err != nil {
		db.logError(err, sqlText, args)
		qr.Error = err
		return
	}

	qr.Cols, err = rows.Columns()
	if err != nil {
		db.logError(err, sqlText, args)
		qr.Error = err
		return
	}
	qr.Rows = make([]Row, 0, 10) // Default len 10
	for rows.Next() {
		row := make([]interface{}, len(qr.Cols))
		for i, _ := range row {
			row[i] = new([]byte)
		}

		rows.Scan(row...)
		qr.Rows = append(qr.Rows, row)
	}
	return
}
656619
func (f *Selectable) GetResult() (interface{}, error) {
	if atomic.LoadUint32(&f.filled) == 0 {
		<-f.wchan()
	}
	return f.val, f.err
}