introspect
This commit is contained in:
parent
134999bc33
commit
138da8a208
13 changed files with 305 additions and 98 deletions
|
@ -59,6 +59,7 @@ type Prompt string
|
|||
type ResponseType string
|
||||
|
||||
type Scopes []string
|
||||
type Scope []string //TODO: hurst?
|
||||
|
||||
func (s Scopes) Encode() string {
|
||||
return strings.Join(s, " ")
|
||||
|
@ -73,6 +74,19 @@ func (s *Scopes) MarshalText() ([]byte, error) {
|
|||
return []byte(s.Encode()), nil
|
||||
}
|
||||
|
||||
func (s *Scope) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(Scopes(*s).Encode())
|
||||
}
|
||||
|
||||
func (s *Scope) UnmarshalJSON(data []byte) error {
|
||||
var str string
|
||||
if err := json.Unmarshal(data, &str); err != nil {
|
||||
return err
|
||||
}
|
||||
*s = Scope(strings.Split(str, " "))
|
||||
return nil
|
||||
}
|
||||
|
||||
type Time time.Time
|
||||
|
||||
func (t *Time) UnmarshalJSON(data []byte) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue