tagger/internal/models/tag.go

28 lines
495 B
Go
Raw Normal View History

2024-04-04 20:37:54 +00:00
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
2024-04-04 20:30:41 +00:00
package models
import (
"io"
"encoding/json"
)
type Tag struct {
Id string `json:"id",omitempty`
Name string `json:"name",omitempty`
Resources []string `json:"resources"`
}
func NewTag() *Tag {
return &Tag{}
}
func NewTagFromJson(jsonReader io.ReadCloser) (*Tag, error) {
t := NewTag()
err := json.NewDecoder(jsonReader).Decode(t)
if err != nil {
return nil, err
}
return t, nil
}