forked from hashicorp/consul
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api: Refactoring into shared query logic
- Loading branch information
Showing
3 changed files
with
46 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package api | ||
|
||
// Raw can be used to do raw queries against custom endpoints | ||
type Raw struct { | ||
c *Client | ||
} | ||
|
||
// Raw returns a handle to query endpoints | ||
func (c *Client) Raw() *Raw { | ||
return &Raw{c} | ||
} | ||
|
||
// Query is used to do a GET request against an endpoint | ||
// and deserialize the response into an interface using | ||
// standard Consul conventions. | ||
func (raw *Raw) Query(endpoint string, out interface{}, q *QueryOptions) (*QueryMeta, error) { | ||
return raw.c.query(endpoint, out, q) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters