-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: CR-22880 update model packages (#462)
* bumped to `v1.1.0` * updated models, added StringMap * return better error information
- Loading branch information
Showing
9 changed files
with
17,443 additions
and
3,673 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
VERSION=v1.0.3 | ||
VERSION=v1.1.0 | ||
|
||
ifndef GOBIN | ||
ifndef GOPATH | ||
|
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
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,30 @@ | ||
package model | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"io" | ||
) | ||
|
||
type StringMap map[string]string | ||
|
||
func (m *StringMap) UnmarshalGQL(v interface{}) error { | ||
anyMap, ok := v.(map[string]any) | ||
if !ok { | ||
return fmt.Errorf("StringMap must be a map") | ||
} | ||
|
||
*m = make(map[string]string, len(anyMap)) | ||
for k, v := range anyMap { | ||
(*m)[k], ok = v.(string) | ||
if !ok { | ||
return fmt.Errorf("StringMap value %q must be strings", k) | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (m StringMap) MarshalGQL(w io.Writer) { | ||
_ = json.NewEncoder(w).Encode(m) | ||
} |
Oops, something went wrong.