entity

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Locales = map[string]string{
	"台灣正體":    "zh-tw",
	"English": "en-us",
	"简体中文":    "zh-cn",
}
View Source
var PageTypes = map[string]string{
	"/admin/users":       "user",
	"/admin/user/:id":    "user",
	"/admin/posts":       "post",
	"/admin/post/create": "post",
	"/admin/post/:id":    "post",
	"/admin/tags":        "tag",
	"/admin/tag/:id":     "tag",
	"/admin/photos":      "media",
	"/admin/navigations": "navigation",
	"/admin/settings":    "settings",
	"/admin/appearances": "appearances",
}
View Source
var RelativeRoots = map[string]string{
	"/wizard":                     "../../",
	"/login":                      "../../",
	"/admin/users":                "../../",
	"/admin/navigations":          "../../",
	"/admin/tags":                 "../../",
	"/admin/settings":             "../../",
	"/admin/appearances":          "../../",
	"/admin/posts":                "../../",
	"/admin/photos":               "../../",
	"/tag/:tag":                   "../../",
	"/author/:author":             "../../",
	"/archive/:year":              "../../",
	"/post/:slug":                 "../../",
	"/admin/user/:id":             "../../../",
	"/navigations/edit":           "../../../",
	"/admin/tag/:id":              "../../../",
	"/admin/appearances/injected": "../../../",
	"/admin/post/create":          "../../../",
	"/admin/trashes/clear":        "../../../",
	"/admin/post/:id":             "../../../",
	"/archive/:year/:month":       "../../../",
	"/admin/tag/:id/delete":       "../../../../",
	"/admin/post/:id/delete":      "../../../../",
	"/admin/post/:id/trash":       "../../../../",
	"/admin/post/:id/untrash":     "../../../../",
	"/archive/:year/:month/:day":  "../../../../",
}
View Source
var Timezones = map[string]int{
	"UTC-12:00": -60 * 60 * 12,
	"UTC-11:30": -60 * 60 * 11.5,
	"UTC-11:00": -60 * 60 * 11,
	"UTC-10:30": -60 * 60 * 10.5,
	"UTC-10:00": -60 * 60 * 10,
	"UTC-09:30": -60 * 60 * 9.5,
	"UTC-09:00": -60 * 60 * 9,
	"UTC-08:30": -60 * 60 * 8.5,
	"UTC-08:00": -60 * 60 * 8,
	"UTC-07:30": -60 * 60 * 7.5,
	"UTC-07:00": -60 * 60 * 7,
	"UTC-06:30": -60 * 60 * 6.5,
	"UTC-06:00": -60 * 60 * 6,
	"UTC-05:30": -60 * 60 * 5.5,
	"UTC-05:00": -60 * 60 * 5,
	"UTC-04:30": -60 * 60 * 4.5,
	"UTC-04:00": -60 * 60 * 4,
	"UTC-03:30": -60 * 60 * 3.5,
	"UTC-03:00": -60 * 60 * 3,
	"UTC-02:30": -60 * 60 * 2.5,
	"UTC-02:00": -60 * 60 * 2,
	"UTC-01:30": -60 * 60 * 1.5,
	"UTC-01:00": -60 * 60 * 1,
	"UTC-00:30": -60 * 60 * 0.5,
	"UTC+00:00": 0,
	"UTC+00:30": +60 * 60 * 0.5,
	"UTC+01:00": +60 * 60 * 1,
	"UTC+01:30": +60 * 60 * 1.5,
	"UTC+02:00": +60 * 60 * 2,
	"UTC+02:30": +60 * 60 * 2.5,
	"UTC+03:00": +60 * 60 * 3,
	"UTC+03:30": +60 * 60 * 3.5,
	"UTC+04:00": +60 * 60 * 4,
	"UTC+04:30": +60 * 60 * 4.5,
	"UTC+05:00": +60 * 60 * 5,
	"UTC+05:30": +60 * 60 * 5.5,
	"UTC+05:45": +60 * 60 * 5.75,
	"UTC+06:00": +60 * 60 * 6,
	"UTC+06:30": +60 * 60 * 6.5,
	"UTC+07:00": +60 * 60 * 7,
	"UTC+07:30": +60 * 60 * 7.5,
	"UTC+08:00": +60 * 60 * 8,
	"UTC+08:30": +60 * 60 * 8.5,
	"UTC+08:45": +60 * 60 * 8.75,
	"UTC+09:00": +60 * 60 * 9,
	"UTC+09:30": +60 * 60 * 9.5,
	"UTC+10:00": +60 * 60 * 10,
	"UTC+10:30": +60 * 60 * 10.5,
	"UTC+11:00": +60 * 60 * 11,
	"UTC+11:30": +60 * 60 * 11.5,
	"UTC+12:00": +60 * 60 * 12,
	"UTC+12:45": +60 * 60 * 12.75,
	"UTC+13:00": +60 * 60 * 13,
	"UTC+13:45": +60 * 60 * 13.75,
	"UTC+14:00": +60 * 60 * 14,
}

Functions

This section is empty.

Types

type AuthorBlock

type AuthorBlock string
const (
	AuthorBlockNone  AuthorBlock = "none"
	AuthorBlockStart AuthorBlock = "start"
	AuthorBlockEnd   AuthorBlock = "end"
)

type ColorScheme

type ColorScheme string
const (
	ColorSchemeLight ColorScheme = "light"
	ColorSchemeDark  ColorScheme = "dark"
	ColorSchemeAuto  ColorScheme = ""
)

type Config

type Config struct {
	Name              string      `json:"name"`
	Description       string      `json:"description"`
	IsPublic          bool        `json:"is_public"`
	DateFormat        string      `json:"date_format"`
	TimeFormat        string      `json:"time_format"`
	Timezone          int         `json:"timezone"`
	InjectedHead      string      `json:"injected_head"`
	InjectedFoot      string      `json:"injected_foot"`
	InjectedPostStart string      `json:"injected_post_start"`
	InjectedPostEnd   string      `json:"injected_post_end"`
	FooterText        string      `json:"footer_text"`
	ColorScheme       ColorScheme `json:"color_scheme"`
	ContainerWidth    string      `json:"container_width"`
	FontFamily        FontFamily  `json:"font_family"`
	FontSize          string      `json:"font_size"`
	HighlightJS       bool        `json:"highlight_js"`
	AuthorBlock       AuthorBlock `json:"author_block"`
	PostsPerPage      int         `json:"posts_per_page"`
	Theme             string      `json:"theme"`
	Locale            string      `json:"locale"`
}

func (*Config) IsCustomDateFormat

func (c *Config) IsCustomDateFormat() bool

func (*Config) IsCustomTimeFormat

func (c *Config) IsCustomTimeFormat() bool

type FontFamily

type FontFamily string
const (
	FontFamilyNotoSans  FontFamily = "sans"
	FontFamilyNotoSerif FontFamily = "serif"
)
type NavigationR struct {
	ID       string
	URL      string
	Name     string
	Sequence int
}
type NavigationW struct {
	ID       string
	URL      string
	Name     string
	Sequence int
}

type Pagination

type Pagination struct {
	CurrentPage int
	TotalCount  int
	TotalPages  int
	Query       template.URL
}

type PostCount

type PostCount struct {
	All      int
	NonTrash int
	Public   int
	Private  int
	Password int
	Draft    int
	Trash    int
}

type PostR

type PostR struct {
	ID              string
	Title           string
	Slug            string
	OriginalExcerpt string
	AuthorID        string
	Password        string
	Visibility      Visibility
	Content         string
	PinnedAt        int64
	PublishedAt     int64
	CreatedAt       int64
	UpdatedAt       int64
	TrashedAt       int64

	Author UserR
	Tags   []*TagR
}

func (*PostR) Cover

func (p *PostR) Cover() string

func (*PostR) Excerpt

func (p *PostR) Excerpt() string

func (*PostR) IsPublished

func (p *PostR) IsPublished() bool

func (*PostR) PublishedAtDatetime

func (p *PostR) PublishedAtDatetime() string

func (*PostR) PublishedAtISO

func (p *PostR) PublishedAtISO() string

func (*PostR) PublishedDate

func (p *PostR) PublishedDate() string

func (*PostR) PublishedDay

func (p *PostR) PublishedDay() string

func (*PostR) PublishedMonth

func (p *PostR) PublishedMonth() string

func (*PostR) PublishedYear

func (p *PostR) PublishedYear() string

func (*PostR) TagNames

func (p *PostR) TagNames() []string

func (*PostR) TagsStr

func (p *PostR) TagsStr() string

type PostW

type PostW struct {
	ID          string
	Title       string
	Slug        string
	Excerpt     string
	AuthorID    string
	Password    string
	Visibility  Visibility
	Content     string
	PinnedAt    int64
	PublishedAt int64
	CreatedAt   int64
	UpdatedAt   int64
	TrashedAt   int64

	TagIDs []string
}

type TagR

type TagR struct {
	ID          string
	Slug        string
	Name        string
	Description string
	CreatedAt   int64
	PostCount   int
}

type TagW

type TagW struct {
	ID          string
	Slug        string
	Name        string
	Description string
	CreatedAt   int64
}

type UserR

type UserR struct {
	ID        string
	Email     string
	Password  string
	Nickname  string
	Bio       string
	CreatedAt int64
}

func (*UserR) Gravatar

func (u *UserR) Gravatar() string

type UserW

type UserW struct {
	ID        string
	Email     string
	Password  string
	Nickname  string
	Bio       string
	CreatedAt int64
}

type Visibility

type Visibility string
const (
	VisibilityUnknown  Visibility = ""
	VisibilityPublic   Visibility = "public"
	VisibilityPrivate  Visibility = "private"
	VisibilityPassword Visibility = "password"
	VisibilityDraft    Visibility = "draft"
	VisibilityTrash    Visibility = "trash" // trash doesn't really exists, it's an abstraction
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL