gopkg.in/rethinkdb/rethinkdb-go.v6@v6.2.2/host.go (about)

     1  package rethinkdb
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  // Host name and port of server
     8  type Host struct {
     9  	Name string
    10  	Port int
    11  }
    12  
    13  // NewHost create a new Host
    14  func NewHost(name string, port int) Host {
    15  	return Host{
    16  		Name: name,
    17  		Port: port,
    18  	}
    19  }
    20  
    21  // Returns host address (name:port)
    22  func (h Host) String() string {
    23  	return fmt.Sprintf("%s:%d", h.Name, h.Port)
    24  }