30 lines
624 B
Go
30 lines
624 B
Go
package bucket
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
)
|
|
|
|
type PhotoMetadataSize struct {
|
|
Width int `json:"width"`
|
|
Height int `json:"height"`
|
|
}
|
|
|
|
func PhotoMetadataSizeUnmarshal(buf []byte) (PhotoMetadataSize, error) {
|
|
s := PhotoMetadataSize{}
|
|
err := json.Unmarshal(buf, &s)
|
|
return s, err
|
|
}
|
|
func PhotoMetadataSizeMarshal(s PhotoMetadataSize) ([]byte, error) {
|
|
return json.MarshalIndent(s, "", "\t")
|
|
}
|
|
|
|
type PhotoMetadataTitle string
|
|
|
|
type PhotoMetadataTags []string
|
|
|
|
func PhotoMetadataTagsUnmarshal(buf []byte) (PhotoMetadataTags, error) {
|
|
tags := string(buf)
|
|
return PhotoMetadataTags(strings.Split(tags, ",")), nil
|
|
}
|