Skip to content

Commit 93a0c5f

Browse files
committed
hasura: use []Request instead of []interface{}
1 parent ff617ab commit 93a0c5f

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

hasura/api.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (api *API) Health(ctx context.Context) error {
124124

125125
// AddSource -
126126
func (api *API) AddSource(ctx context.Context, hasura *config.Hasura, cfg config.Database) error {
127-
req := request{
127+
req := Request{
128128
Type: "pg_add_source",
129129
Args: map[string]interface{}{
130130
"name": hasura.Source,
@@ -144,7 +144,7 @@ func (api *API) AddSource(ctx context.Context, hasura *config.Hasura, cfg config
144144

145145
// ExportMetadata -
146146
func (api *API) ExportMetadata(ctx context.Context) (Metadata, error) {
147-
req := VersionedRequest{
147+
req := versionedRequest{
148148
Type: "export_metadata",
149149
Version: 2,
150150
Args: map[string]interface{}{},
@@ -156,7 +156,7 @@ func (api *API) ExportMetadata(ctx context.Context) (Metadata, error) {
156156

157157
// ReplaceMetadata -
158158
func (api *API) ReplaceMetadata(ctx context.Context, data *Metadata) error {
159-
req := VersionedRequest{
159+
req := versionedRequest{
160160
Type: "replace_metadata",
161161
Version: 1,
162162
Args: data,
@@ -173,7 +173,7 @@ func (api *API) ReplaceMetadata(ctx context.Context, data *Metadata) error {
173173

174174
// TrackTable -
175175
func (api *API) TrackTable(ctx context.Context, name string, source string) error {
176-
req := request{
176+
req := Request{
177177
Type: "pg_track_table",
178178
Args: map[string]string{
179179
"table": name,
@@ -190,7 +190,7 @@ func (api *API) CustomConfiguration(ctx context.Context, conf interface{}) error
190190

191191
// CreateSelectPermissions - A select permission is used to restrict access to only the specified columns and rows.
192192
func (api *API) CreateSelectPermissions(ctx context.Context, table, source string, role string, perm Permission) error {
193-
req := request{
193+
req := Request{
194194
Type: "pg_create_select_permission",
195195
Args: map[string]interface{}{
196196
"table": table,
@@ -204,7 +204,7 @@ func (api *API) CreateSelectPermissions(ctx context.Context, table, source strin
204204

205205
// DropSelectPermissions -
206206
func (api *API) DropSelectPermissions(ctx context.Context, table, source string, role string) error {
207-
req := request{
207+
req := Request{
208208
Type: "pg_drop_select_permission",
209209
Args: map[string]interface{}{
210210
"table": table,
@@ -217,7 +217,7 @@ func (api *API) DropSelectPermissions(ctx context.Context, table, source string,
217217

218218
// CreateRestEndpoint -
219219
func (api *API) CreateRestEndpoint(ctx context.Context, name, url, queryName, collectionName string) error {
220-
req := request{
220+
req := Request{
221221
Type: "create_rest_endpoint",
222222
Args: map[string]interface{}{
223223
"name": name,

hasura/hasura.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func checkHealth(ctx context.Context, api *API) {
4141
}
4242

4343
// Create - creates hasura models
44-
func Create(ctx context.Context, hasura *config.Hasura, cfg config.Database, views []string, custom []interface{}, models ...interface{}) error {
44+
func Create(ctx context.Context, hasura *config.Hasura, cfg config.Database, views []string, custom []Request, models ...interface{}) error {
4545
if hasura == nil {
4646
return nil
4747
}

hasura/requests.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ package hasura
22

33
import "github.com/pkg/errors"
44

5-
type request struct {
5+
type Request struct {
66
Type string `json:"type"`
77
Args interface{} `json:"args"`
88
}
99

10-
type VersionedRequest struct {
10+
type versionedRequest struct {
1111
Type string `json:"type"`
1212
Version int `json:"int"`
1313
Args interface{} `json:"args"`

0 commit comments

Comments
 (0)