models

package
v0.0.0-...-759ca40 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port    string `yaml:"port"`
	Addr    string `yaml:"addr"`
	Verbose bool   `yaml:"verbose"`

	UseHTTPS bool   `yaml:"use-https",omitempty`
	CertPath string `yaml:"cert-path,omitempty"`
	KeyPath  string `yaml:"key-path,omitempty"`

	LogFile string `yaml:"log-file,omitempty"`
	Log     *utils.Log

	TplVars     map[string]interface{} `yaml:"vars,omitempty"`
	TplErroPage string                 `yaml:"error-page,omitempty"`

	WriteTimeOut int `yaml:"write-timeout,omitempty"`
	IdleTimeOut  int `yaml:"idle-timeout,omitempty"`
}

func (*Config) LoadConfig

func (c *Config) LoadConfig(path string)

type Headers

type Headers map[string]string

func (*Headers) AddToHttp

func (h *Headers) AddToHttp(header *http.Header)

func (*Headers) Set

func (h *Headers) Set(s string) error

func (*Headers) String

func (h *Headers) String() string

type SiteFile

type SiteFile struct {
	FileName   string
	FileDir    string
	URLPath    string
	MimeType   string
	Data       []byte
	Rendered   []byte
	IsMarkdown bool
	Checksum   [32]byte
	Attrs      SiteFileAttr
}

type SiteFileAttr

type SiteFileAttr struct {
	Template    string                 `yaml:"template"`         /* use template */
	Render      bool                   `yaml:"render,omitempty"` /* render or plain */
	ExtraFields map[string]interface{} `yaml:",inline,omitempty"`
}

type SiteFiles

type SiteFiles map[string]*SiteFile

func (SiteFiles) AddFile

func (sf SiteFiles) AddFile(s *SiteFile)

func (SiteFiles) FindFileByUrl

func (sf SiteFiles) FindFileByUrl(path string) (*SiteFile, bool)

func (SiteFiles) GenerateSiteMap

func (sf SiteFiles) GenerateSiteMap() (sm SiteMap)

func (*SiteFiles) Keys

func (sf *SiteFiles) Keys() (k []string)

func (SiteFiles) RemoveFile

func (sf SiteFiles) RemoveFile(s *SiteFile)

func (SiteFiles) UpdateFile

func (sf SiteFiles) UpdateFile(s *SiteFile)

type SiteMap

type SiteMap struct {
	Places *SitePlace `json:"places"`
}

func (*SiteMap) ToJSON

func (sm *SiteMap) ToJSON() ([]byte, error)

type SitePlace

type SitePlace struct {
	Level    int          `json:"level"`
	Parent   *SitePlace   `json:"parent,omitempty"`
	Self     *SiteFile    `json:"self"`
	Children []*SitePlace `json:"children,omitempty"`
}

func (*SitePlace) Abandon

func (sp *SitePlace) Abandon()

func (*SitePlace) Describe

func (sp *SitePlace) Describe()

type SiteTemplate

type SiteTemplate struct {
	FileName string
	FileDir  string
	Tpl      *template.Template
}

Jump to

Keyboard shortcuts

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