mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-09 20:37:52 +00:00
Unexport DefaultURI
This commit is contained in:
parent
c102143b50
commit
761f6878fb
4 changed files with 12 additions and 12 deletions
|
|
@ -159,7 +159,7 @@ func stringSlicesAreEqual(a, b []string) bool {
|
|||
// using defaults when necessary.
|
||||
func AddressWithDefaults(addr string) (*URI, error) {
|
||||
if addr == "" {
|
||||
return DefaultURI(), nil
|
||||
return defaultURI(), nil
|
||||
} else {
|
||||
return NewURIFromAddress(addr)
|
||||
}
|
||||
|
|
|
|||
6
uri.go
6
uri.go
|
|
@ -47,8 +47,8 @@ type URI struct {
|
|||
Port uint16 `json:"port"`
|
||||
}
|
||||
|
||||
// DefaultURI creates and returns the default URI.
|
||||
func DefaultURI() *URI {
|
||||
// defaultURI creates and returns the default URI.
|
||||
func defaultURI() *URI {
|
||||
return &URI{
|
||||
Scheme: "http",
|
||||
Host: "localhost",
|
||||
|
|
@ -68,7 +68,7 @@ func (u URIs) HostPortStrings() []string {
|
|||
|
||||
// NewURIFromHostPort returns a URI with specified host and port.
|
||||
func NewURIFromHostPort(host string, port uint16) (*URI, error) {
|
||||
uri := DefaultURI()
|
||||
uri := defaultURI()
|
||||
err := uri.SetHost(host)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "setting uri host")
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ package pilosa
|
|||
import "testing"
|
||||
|
||||
func TestDefaultURI(t *testing.T) {
|
||||
uri := DefaultURI()
|
||||
uri := defaultURI()
|
||||
compare(t, uri, "http", "localhost", 10101)
|
||||
}
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ func TestURIPath(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSetScheme(t *testing.T) {
|
||||
uri := DefaultURI()
|
||||
uri := defaultURI()
|
||||
target := "fun"
|
||||
err := uri.SetScheme(target)
|
||||
if err != nil {
|
||||
|
|
@ -89,7 +89,7 @@ func TestSetScheme(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSetHost(t *testing.T) {
|
||||
uri := DefaultURI()
|
||||
uri := defaultURI()
|
||||
target := "10.20.30.40"
|
||||
err := uri.SetHost(target)
|
||||
if err != nil {
|
||||
|
|
@ -101,7 +101,7 @@ func TestSetHost(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSetPort(t *testing.T) {
|
||||
uri := DefaultURI()
|
||||
uri := defaultURI()
|
||||
target := uint16(9999)
|
||||
uri.SetPort(target)
|
||||
if uri.Port != target {
|
||||
|
|
@ -110,7 +110,7 @@ func TestSetPort(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSetInvalidScheme(t *testing.T) {
|
||||
uri := DefaultURI()
|
||||
uri := defaultURI()
|
||||
err := uri.SetScheme("?invalid")
|
||||
if err == nil {
|
||||
t.Fatalf("Should have failed")
|
||||
|
|
@ -118,7 +118,7 @@ func TestSetInvalidScheme(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSetInvalidHost(t *testing.T) {
|
||||
uri := DefaultURI()
|
||||
uri := defaultURI()
|
||||
err := uri.SetHost("index?.pilosa.com")
|
||||
if err == nil {
|
||||
t.Fatalf("Should have failed")
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ func NewTestCluster(n int) *cluster {
|
|||
|
||||
// NewTestURI is a test URI creator that intentionally swallows errors.
|
||||
func NewTestURI(scheme, host string, port uint16) URI {
|
||||
uri := DefaultURI()
|
||||
uri := defaultURI()
|
||||
uri.SetScheme(scheme)
|
||||
uri.SetHost(host)
|
||||
uri.SetPort(port)
|
||||
|
|
@ -63,7 +63,7 @@ func NewTestURI(scheme, host string, port uint16) URI {
|
|||
}
|
||||
|
||||
func NewTestURIFromHostPort(host string, port uint16) URI {
|
||||
uri := DefaultURI()
|
||||
uri := defaultURI()
|
||||
uri.SetHost(host)
|
||||
uri.SetPort(port)
|
||||
return *uri
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue