mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
initial commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package utils
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type NullString struct {
|
||||
Set bool
|
||||
Value *string
|
||||
}
|
||||
|
||||
func (ns *NullString) UnmarshalJSON(b []byte) error {
|
||||
ns.Set = true
|
||||
if string(b) == "null" {
|
||||
ns.Value = nil
|
||||
return nil
|
||||
}
|
||||
var s string
|
||||
if err := json.Unmarshal(b, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
ns.Value = &s
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user