diff options
author | George Goldberg <george@gberg.me> | 2018-02-06 17:25:53 +0000 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2018-02-06 17:25:53 +0000 |
commit | 7941c30117efe1b957ac0458c2f0479e3824196d (patch) | |
tree | df791632a9dc790a6f73dec53aae3ba919ebda63 /model/session.go | |
parent | e1cd64613591cf5a990442a69ebf188258bd0cb5 (diff) | |
parent | 034dbc07e3068c482e654b6a1a8fcbe4b01c44f3 (diff) | |
download | chat-7941c30117efe1b957ac0458c2f0479e3824196d.tar.gz chat-7941c30117efe1b957ac0458c2f0479e3824196d.tar.bz2 chat-7941c30117efe1b957ac0458c2f0479e3824196d.zip |
Merge branch 'master' into advanced-permissions-phase-1
Diffstat (limited to 'model/session.go')
-rw-r--r-- | model/session.go | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/model/session.go b/model/session.go index 704af067c..a407af26a 100644 --- a/model/session.go +++ b/model/session.go @@ -43,23 +43,14 @@ func (me *Session) DeepCopy() *Session { } func (me *Session) ToJson() string { - b, err := json.Marshal(me) - if err != nil { - return "" - } else { - return string(b) - } + b, _ := json.Marshal(me) + return string(b) } func SessionFromJson(data io.Reader) *Session { - decoder := json.NewDecoder(data) - var me Session - err := decoder.Decode(&me) - if err == nil { - return &me - } else { - return nil - } + var me *Session + json.NewDecoder(data).Decode(&me) + return me } func (me *Session) PreSave() { @@ -140,12 +131,7 @@ func SessionsToJson(o []*Session) string { } func SessionsFromJson(data io.Reader) []*Session { - decoder := json.NewDecoder(data) var o []*Session - err := decoder.Decode(&o) - if err == nil { - return o - } else { - return nil - } + json.NewDecoder(data).Decode(&o) + return o } |