-
Notifications
You must be signed in to change notification settings - Fork 3
/
enums.go
116 lines (88 loc) · 2.88 KB
/
enums.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package wordpress
import "errors"
// PostStatus represents a WordPress post status
//
// Posts in WordPress can have one of a number of statuses.
//
// The status of a given post determines how WordPress handles that post.
type PostStatus string
const (
// PostStatusPublish is a published post
PostStatusPublish PostStatus = "publish"
// PostStatusFuture is a post which has been
// published but it's publish date is in the future
PostStatusFuture PostStatus = "future"
// PostStatusDraft is a draft post
PostStatusDraft PostStatus = "draft"
// PostStatusPending is a post which is awaiting approval
PostStatusPending PostStatus = "pending"
// PostStatusPrivate is a private post
PostStatusPrivate PostStatus = "private"
// PostStatusTrash is a post that was trashed
PostStatusTrash PostStatus = "trash"
// PostStatusAutoDraft is an auto-saved post
PostStatusAutoDraft PostStatus = "auto-draft"
// PostStatusInherit inherits its status from its parent
PostStatusInherit PostStatus = "inherit"
)
// Scan formats incoming data from a sql database
func (s PostStatus) Scan(src interface{}) error {
if arr, ok := src.([]uint8); ok {
s = PostStatus(arr)
return nil
}
return errors.New("the source is not a []uint8")
}
// PostType represents a WordPress post type
//
// There are five post types that are readily available to users
// or internally used by the WordPress installation by default:
//
// Post, Page, Attachment, Revision, Navigation Menu Item
//
// https://codex.wordpress.org/Post_Types
type PostType string
const (
// PostTypeAttachment is an attachment
PostTypeAttachment PostType = "attachment"
// PostTypeNavMenuItem is a menu item
PostTypeNavMenuItem PostType = "nav_menu_item"
// PostTypePage is a page
PostTypePage PostType = "page"
// PostTypePost is a post
PostTypePost PostType = "post"
// PostTypeRevision is a revision
PostTypeRevision PostType = "revision"
)
// Scan formats incoming data from a sql database
func (t PostType) Scan(src interface{}) error {
if arr, ok := src.([]uint8); ok {
t = PostType(arr)
return nil
}
return errors.New("the source is not a []uint8")
}
// MenuItemType represents menu item link types
//
// i.e. post_type, taxonomy, custom
type MenuItemType string
const (
// MenuItemTypePost is a link to a specific post or page
MenuItemTypePost MenuItemType = "post_type"
// MenuItemTypeTaxonomy is a link to a category or post tag
MenuItemTypeTaxonomy MenuItemType = "taxonomy"
// MenuItemTypeCustom is a custom or external link
MenuItemTypeCustom MenuItemType = "custom"
)
// Taxonomy represents term taxonomy names
//
// i.e. categories, nav_menu, post_tag
type Taxonomy string
const (
// TaxonomyCategory is for post categories
TaxonomyCategory Taxonomy = "category"
// TaxonomyNavMenu is for menu locations
TaxonomyNavMenu Taxonomy = "nav_menu"
// TaxonomyPostTag is for post tags
TaxonomyPostTag Taxonomy = "post_tag"
)