-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
template.go
38 lines (33 loc) · 1.19 KB
/
template.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package snd
import (
"fmt"
"strings"
)
type TemplateConfig struct {
Key string `json:"key"`
Name string `json:"name"`
Description string `json:"description"`
Type string `json:"type"`
Default interface{} `json:"default"`
}
// Template represents one S&D template.
type Template struct {
Name string `json:"name"`
Slug string `json:"slug"`
Author string `json:"author"`
Description string `json:"description"`
CopyrightNotice string `json:"copyrightNotice"`
PrintTemplate string `json:"printTemplate"`
ListTemplate string `json:"listTemplate"`
SkeletonData map[string]interface{} `json:"skeletonData"`
Images map[string]string `json:"images"`
Config []TemplateConfig `json:"config"`
DataSources []string `json:"dataSources"`
Version string `json:"version"`
}
func (t Template) ID() string {
return fmt.Sprintf("tmpl:%s+%s", t.Author, t.Slug)
}
func IsTemplateID(id string) bool {
return strings.HasPrefix(id, "tmpl:")
}