Expose the Account API (RADIUS users)

* Adds Account CRUD API
* Enahnces `emptyStringInt` with a predicate for dynamically setting
  which value should be interpreted as a blank JSON payload
This commit is contained in:
James Stephenson
2020-08-21 08:08:51 -04:00
committed by Paul Tyng
parent ae40573bb7
commit 47fa522aba
7 changed files with 141 additions and 2 deletions

View File

@@ -31,3 +31,11 @@ func (e *emptyStringInt) UnmarshalJSON(b []byte) error {
*e = emptyStringInt(i)
return nil
}
func (e *emptyStringInt) MarshalJSON() ([]byte, error) {
if e == nil || *e == 0 {
return []byte(`""`), nil
}
return []byte(strconv.Itoa(int(*e))), nil
}