Documentation ¶
Index ¶
- Constants
- Variables
- type Admin
- type Configuration
- type Menu
- type Meta
- type MetaType
- type MultisiteStrategy
- type Node
- type OTP
- type Page
- func (p Page) GetID() int64
- func (p Page) IsCMS() bool
- func (p Page) IsDynamic() bool
- func (p Page) IsEnabled(now time.Time) bool
- func (p Page) IsError() bool
- func (p Page) IsHybrid() bool
- func (p Page) IsInternal() bool
- func (p Page) String() string
- func (p Page) WithAlias(alias string) Page
- func (p Page) WithError(pattern string) Page
- func (p Page) WithFixedURL() Page
- func (p Page) WithInternal(pattern string) Page
- type Password
- type Site
- type Template
- type TemplateType
Constants ¶
View Source
const ( Host = MultisiteStrategy("host") HostByLocale = MultisiteStrategy("host-by-locale") HostWithPath = MultisiteStrategy("host-with-path") HostWithPathByLocale = MultisiteStrategy("host-with-path-by-locale") )
View Source
const ( MetaName = MetaType("name") MetaEquiv = MetaType("http-equiv") MetaProperty = MetaType("property") )
View Source
const ( PageCMS = "_page_cms" PageAliasPrefix = "_page_alias_" PageInternalPrefix = "_page_internal_" PageInternalCreate = PageInternalPrefix + "create" PageErrorPrefix = PageInternalPrefix + "error_" PageErrorInternal = PageErrorPrefix + "internal" PageError4xx = PageErrorPrefix + "4xx" PageError5xx = PageErrorPrefix + "5xx" )
View Source
const ( TemplateDB = TemplateType("db") TemplateFS = TemplateType("fs") )
Variables ¶
View Source
var ( ErrPasswordIsEmpty = errors.New("password: is empty") ErrPasswordNotValid = errors.New("password: is not valid") ErrPasswordShort = errors.New("password: is too short, must be at least 8 characters long") ErrPasswordLong = errors.New("password: is too long, must be at most 64 characters long") )
View Source
var ErrOTPNotValid = errors.New("otp: is not valid")
View Source
var MetaTypes = []MetaType{MetaName, MetaEquiv, MetaProperty}
View Source
var MultisiteStrategies = []MultisiteStrategy{Host, HostByLocale, HostWithPath, HostWithPathByLocale}
View Source
var TemplateTypes = []TemplateType{TemplateDB, TemplateFS}
Functions ¶
This section is empty.
Types ¶
type Admin ¶
type Admin struct { ID int64 `json:"id,omitempty" required:"true"` Avatar string `json:"avatar,omitempty" required:"true"` Email string `json:"email,omitempty" required:"true" format:"email"` Roles []string `json:"roles,omitempty" required:"true"` Salt string `json:"_" hidden:"true"` Password Password `json:"-" hidden:"true"` OTP OTP `json:"-" hidden:"true"` Created time.Time `json:"created,omitempty" required:"true"` Updated time.Time `json:"updated,omitempty" required:"true"` }
func (Admin) ValidateOTP ¶
func (Admin) ValidatePassword ¶
func (Admin) WithRandomSalt ¶
type Configuration ¶
type Configuration struct { Debug bool `json:"debug,omitempty" yaml:"debug,omitempty" required:"true"` Multisite MultisiteStrategy `` /* 137-byte string literal not displayed */ FallbackLocale string `json:"fallbackLocale,omitempty" yaml:"fallbackLocale,omitempty" required:"false"` IgnoreRequestPatterns []string `json:"ignoreRequestPatterns,omitempty" yaml:"ignoreRequestPatterns,omitempty" required:"false"` IgnoreRequestURIs []string `json:"ignoreRequestURIs,omitempty" yaml:"ignoreRequestURIs,omitempty" required:"false"` CatchErrors map[string][]int `json:"catchErrors,omitempty" yaml:"catchErrors,omitempty" required:"false"` Additional map[string]string `json:"additional,omitempty" yaml:"additional,omitempty" required:"false"` }
func NewConfiguration ¶
func NewConfiguration() Configuration
func (Configuration) IgnorePattern ¶
func (c Configuration) IgnorePattern(pattern string) bool
func (Configuration) IgnoreURI ¶
func (c Configuration) IgnoreURI(uri string) bool
func (Configuration) With ¶
func (c Configuration) With(other Configuration) Configuration
type Menu ¶
type Menu struct { ID int64 `json:"id,omitempty" yaml:"id,omitempty" required:"true"` NodeID *int64 `json:"nodeID,omitempty" yaml:"nodeID,omitempty" required:"false"` Name string `json:"name,omitempty" yaml:"name,omitempty" required:"true"` Handle string `json:"handle,omitempty" yaml:"handle,omitempty" required:"true"` Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty" required:"true"` Created time.Time `json:"created,omitempty" yaml:"created,omitempty" required:"true"` Updated time.Time `json:"updated,omitempty" yaml:"updated,omitempty" required:"true"` Node *Node `json:"-" yaml:"-"` }
func (Menu) WithFixedHandle ¶
type Meta ¶
type MultisiteStrategy ¶
type MultisiteStrategy string
func (MultisiteStrategy) IsZero ¶
func (t MultisiteStrategy) IsZero() bool
func (MultisiteStrategy) String ¶
func (t MultisiteStrategy) String() string
type Node ¶
type Node struct { ID int64 `json:"id,omitempty" yaml:"id,omitempty" required:"true"` ParentID int64 `json:"parentID,omitempty" yaml:"parentID,omitempty" required:"true"` Name string `json:"name,omitempty" yaml:"name,omitempty" required:"true"` Label string `json:"label,omitempty" yaml:"label,omitempty" required:"false"` URI string `json:"uri,omitempty" yaml:"uri,omitempty" required:"false"` Path string `json:"path,omitempty" yaml:"path,omitempty" required:"true"` Level int `json:"level,omitempty" yaml:"level,omitempty" required:"false"` Position int `json:"position,omitempty" yaml:"position,omitempty" required:"false"` DisplayChildren bool `json:"displayChildren,omitempty" yaml:"displayChildren,omitempty" required:"false"` Display bool `json:"display,omitempty" yaml:"display,omitempty" required:"false"` Attributes map[string]string `json:"attributes,omitempty" yaml:"attributes,omitempty" required:"false"` LinkAttributes map[string]string `json:"linkAttributes,omitempty" yaml:"linkAttributes,omitempty" required:"false"` ChildrenAttributes map[string]string `json:"childrenAttributes,omitempty" yaml:"childrenAttributes,omitempty" required:"false"` LabelAttributes map[string]string `json:"labelAttributes,omitempty" yaml:"labelAttributes,omitempty" required:"false"` Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty" required:"false"` Created time.Time `json:"created,omitempty" yaml:"created,omitempty" required:"true"` Updated time.Time `json:"updated,omitempty" yaml:"updated,omitempty" required:"true"` Current bool `json:"-" yaml:"-"` Ancestor bool `json:"-" yaml:"-"` Parent *Node `json:"-" yaml:"-"` Menu *Menu `json:"-" yaml:"-"` Children []*Node `json:"-" yaml:"-"` }
func (Node) HasChildren ¶
func (Node) WithFixedPathAndLevel ¶
type Page ¶
type Page struct { ID int64 `json:"id,omitempty" yaml:"id,omitempty" required:"true"` SiteID int64 `json:"siteID,omitempty" yaml:"siteID,omitempty" required:"true"` ParentID *int64 `json:"parentID,omitempty" yaml:"parentID,omitempty" required:"false"` Name string `json:"name,omitempty" yaml:"name,omitempty" required:"true"` Title string `json:"title,omitempty" yaml:"title,omitempty" required:"false"` Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty" required:"true"` Alias string `json:"alias,omitempty" yaml:"alias,omitempty" required:"false"` Slug string `json:"slug,omitempty" yaml:"slug,omitempty" required:"false"` URL string `json:"url,omitempty" yaml:"url,omitempty" required:"false"` CustomURL string `json:"customURL,omitempty" yaml:"customURL,omitempty" required:"false"` Javascript string `json:"javascript,omitempty" yaml:"javascript,omitempty" required:"false"` Stylesheet string `json:"stylesheet,omitempty" yaml:"stylesheet,omitempty" required:"false"` Template string `json:"template,omitempty" yaml:"template,omitempty" required:"true"` Decorate bool `json:"decorate,omitempty" yaml:"decorate,omitempty" required:"false"` Position int `json:"position,omitempty" yaml:"position,omitempty" required:"false"` Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty" required:"false"` Metas []Meta `json:"metas,omitempty" yaml:"metas,omitempty" required:"false"` Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty" required:"false"` Created time.Time `json:"created,omitempty" yaml:"created,omitempty" required:"true"` Updated time.Time `json:"updated,omitempty" yaml:"updated,omitempty" required:"true"` Published *time.Time `json:"published,omitempty" yaml:"published,omitempty" required:"false"` Expired *time.Time `json:"expired,omitempty" yaml:"expired,omitempty" required:"false"` Site *Site `json:"-" yaml:"-"` Parent *Page `json:"-" yaml:"-"` Children []Page `json:"-" yaml:"-"` }
func (Page) IsInternal ¶
func (Page) WithFixedURL ¶
func (Page) WithInternal ¶
type Site ¶
type Site struct { ID int64 `json:"id,omitempty" yaml:"id,omitempty" required:"true"` Name string `json:"name,omitempty" yaml:"name,omitempty" required:"true"` Title string `json:"title,omitempty" yaml:"title,omitempty" required:"false"` Separator string `json:"separator,omitempty" yaml:"separator,omitempty" required:"true"` Host string `json:"host,omitempty" yaml:"host,omitempty" required:"true"` Locale string `json:"locale,omitempty" yaml:"locale,omitempty" required:"false"` RelativePath string `json:"relativePath,omitempty" yaml:"relativePath,omitempty" required:"false"` IsDefault bool `json:"isDefault,omitempty" yaml:"isDefault,omitempty" required:"false"` Javascript string `json:"javascript,omitempty" yaml:"javascript,omitempty" required:"false"` Stylesheet string `json:"stylesheet,omitempty" yaml:"stylesheet,omitempty" required:"false"` Metas []Meta `json:"metas,omitempty" yaml:"metas,omitempty" required:"false"` Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty" required:"false"` Created time.Time `json:"created,omitempty" yaml:"created,omitempty" required:"true"` Updated time.Time `json:"updated,omitempty" yaml:"updated,omitempty" required:"true"` Published *time.Time `json:"published,omitempty" yaml:"published,omitempty" required:"false"` Expired *time.Time `json:"expired,omitempty" yaml:"expired,omitempty" required:"false"` // contains filtered or unexported fields }
func (Site) IsLocalhost ¶
type Template ¶
type Template struct { ID int64 `json:"id,omitempty" yaml:"id,omitempty" required:"true"` Name string `json:"name,omitempty" yaml:"name,omitempty" required:"true"` Content string `json:"content,omitempty" yaml:"content,omitempty" required:"false"` Type TemplateType `json:"type,omitempty" yaml:"type,omitempty" required:"true" enum:"db,fs"` Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty" required:"false"` Created time.Time `json:"created,omitempty" yaml:"created,omitempty" required:"true"` Updated time.Time `json:"updated,omitempty" yaml:"updated,omitempty" required:"true"` }
type TemplateType ¶
type TemplateType string
func (TemplateType) IsZero ¶
func (t TemplateType) IsZero() bool
func (TemplateType) String ¶
func (t TemplateType) String() string
Click to show internal directories.
Click to hide internal directories.