Home | History | Annotate | Download | only in progs
      1 // Copyright 2012 The Go Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style
      3 // license that can be found in the LICENSE file.
      4 
      5 package query
      6 
      7 type Conn string
      8 
      9 func (c Conn) DoQuery(query string) Result {
     10 	return Result("result")
     11 }
     12 
     13 type Result string
     14 
     15 func Query(conns []Conn, query string) Result {
     16 	ch := make(chan Result, 1)
     17 	for _, conn := range conns {
     18 		go func(c Conn) {
     19 			select {
     20 			case ch <- c.DoQuery(query):
     21 			default:
     22 			}
     23 		}(conn)
     24 	}
     25 	return <-ch
     26 }
     27 
     28 // STOP OMIT
     29