mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-09 22:51:02 +00:00
Trivial NewClientFromURI simplification
This commit is contained in:
parent
48c0dbaee7
commit
0f8f596376
3 changed files with 6 additions and 13 deletions
|
|
@ -61,10 +61,11 @@ func NewClient(host string, options *ClientOptions) (*Client, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return NewClientFromURI(uri, options)
|
||||
client := NewClientFromURI(uri, options)
|
||||
return client, nil
|
||||
}
|
||||
|
||||
func NewClientFromURI(defaultURI *URI, options *ClientOptions) (*Client, error) {
|
||||
func NewClientFromURI(defaultURI *URI, options *ClientOptions) *Client {
|
||||
if options == nil {
|
||||
options = &ClientOptions{}
|
||||
}
|
||||
|
|
@ -76,7 +77,7 @@ func NewClientFromURI(defaultURI *URI, options *ClientOptions) (*Client, error)
|
|||
return &Client{
|
||||
defaultURI: defaultURI,
|
||||
HTTPClient: client,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
// Host returns the host the client was initialized with.
|
||||
|
|
|
|||
|
|
@ -55,12 +55,8 @@ func NewExecutor(clientOptions *ClientOptions) (*Executor, error) {
|
|||
if clientOptions == nil {
|
||||
clientOptions = &ClientOptions{}
|
||||
}
|
||||
client, err := NewClientFromURI(nil, clientOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Executor{
|
||||
client: client,
|
||||
client: NewClientFromURI(nil, clientOptions),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1506,11 +1506,7 @@ func (h *Handler) handlePostFrameRestore(w http.ResponseWriter, r *http.Request)
|
|||
}
|
||||
|
||||
// Create a client for the remote cluster.
|
||||
client, err := NewClientFromURI(host, h.ClientOptions)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
client := NewClientFromURI(host, h.ClientOptions)
|
||||
|
||||
// Determine the maximum number of slices.
|
||||
maxSlices, err := client.MaxSliceByIndex(r.Context())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue