예제 #1
0
func NewKeyData(t string, value interface{}) (*KeyData, error) {
	m, err := json.Marshal(value)
	if err != nil {
		return nil, err
	}
	return &KeyData{t, utils.RawMessage(m)}, nil
}
예제 #2
0
func NewKeyPermission(t string, value interface{}) (*KeyPermission, error) {
	m, err := json.Marshal(value)
	if err != nil {
		return nil, err
	}
	raw := utils.RawMessage(m)
	return &KeyPermission{t, &raw}, nil
}