18F/e-QIP-prototype

View on GitHub
api/checkbox.go

Summary

Maintainability
A
0 mins
Test Coverage
package api

import "encoding/json"

// Checkbox is a basic input.
type Checkbox struct {
    ID      int    `json:"-"`
    Value   string `json:"value"`
    Checked bool   `json:"checked,omitempty"`
}

// Unmarshal bytes in to the entity properties.
func (entity *Checkbox) Unmarshal(raw []byte) error {
    return json.Unmarshal(raw, entity)
}

// Marshal to payload structure
func (entity *Checkbox) Marshal() Payload {
    return MarshalPayloadEntity("checkbox", entity)
}