simple_css_template

package module
v0.0.0-...-bc64a57 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

README

simple_css_template

simple_css_template

example

http://127.0.0.1:8000/table?TableBase={"Title":"书单","Footer":"<a href="https://github.com/sun-moon-star-star/simple_css_template">sun-moon-star-star","HeaderCells":["序号","书名","作者"],"DataCells":[["1","代码整洁之道","[美]Robert C.Martin"],["2","深入Linux内核架构","[德]Wolfgang Mauerer"],["3","算法导论","[美]Thomas H. Cormen"]]}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexTemplate

func IndexTemplate(APIName string, templateType reflect.Type)

func IndexTemplateWrapper

func IndexTemplateWrapper(fun TemplaterHandleFunc) func(w http.ResponseWriter, r *http.Request)

func ListenPort

func ListenPort(port int)

func RegisterAPIs

func RegisterAPIs(prefix string)

Types

type Converter

type Converter struct {
	Data interface{}       `json:"-"`
	Maps map[string]string `json:"Maps"`
}

func (*Converter) Get

func (c *Converter) Get(model string) (interface{}, error)

func (*Converter) GetConverter

func (c *Converter) GetConverter() *Converter

func (*Converter) Map

func (c *Converter) Map() (map[string]interface{}, error)

type HTML

type HTML struct {
	Utils     `json:"Utils"`
	*HTMLBase `json:"HTMLBase"`
}

func (*HTML) GetHTMLBase

func (html *HTML) GetHTMLBase() interface{}

func (*HTML) SetHTMLBase

func (html *HTML) SetHTMLBase(data interface{})

type HTMLBase

type HTMLBase struct {
	Content string `json:"Content"`
}

func (*HTMLBase) HTML

func (html *HTMLBase) HTML(respWriter io.Writer) error

func (*HTMLBase) HTMLBaseType

func (html *HTMLBase) HTMLBaseType() reflect.Type

type Markdown

type Markdown struct {
	Utils         `json:"Utils"`
	*MarkdownBase `json:"MarkdownBase"`
}

func (*Markdown) GetHTMLBase

func (markdown *Markdown) GetHTMLBase() interface{}

func (*Markdown) SetHTMLBase

func (markdown *Markdown) SetHTMLBase(data interface{})

type MarkdownBase

type MarkdownBase struct {
	Content string `json:"Content"`
}

func (*MarkdownBase) HTML

func (markdown *MarkdownBase) HTML(respWriter io.Writer) error

func (*MarkdownBase) HTMLBaseType

func (markdown *MarkdownBase) HTMLBaseType() reflect.Type

type Network

type Network struct {
	URL string `json:"URL"`
}
var EmptyNetwork Network

func (*Network) GetData

func (n *Network) GetData() (interface{}, error)

func (*Network) GetNetwork

func (n *Network) GetNetwork() *Network

type RawData

type RawData struct {
	Datas interface{}
}

func (*RawData) GetRawData

func (r *RawData) GetRawData() interface{}

func (*RawData) SetRawData

func (r *RawData) SetRawData(datas interface{})

type Smtp

type Smtp struct {
	WithoutAuth bool `json:"WithoutAuth"`

	Host     string `json:"Host"`
	Port     int    `json:"Port"`
	Username string `json:"Username"`
	Password string `json:"Password"`

	To      string `json:"To"`
	From    string `json:"From"`
	Subject string `json:"Subject"`
}
var EmptySmtp Smtp

func (*Smtp) GetSmtp

func (s *Smtp) GetSmtp() *Smtp

func (*Smtp) Write

func (s *Smtp) Write(html []byte) (int, error)

type Table

type Table struct {
	Utils      `json:"Utils"`
	*TableBase `json:"TableBase"`
}

func (*Table) GetHTMLBase

func (table *Table) GetHTMLBase() interface{}

func (*Table) SetHTMLBase

func (table *Table) SetHTMLBase(data interface{})

type TableBase

type TableBase struct {
	Title          string            `json:"Title"`
	Overview       string            `json:"Overview"`
	HeaderCells    []string          `json:"HeaderCells"`
	HeaderCellsMap map[string]string `json:"HeaderCellsMap"`
	DataConverter  map[string]string `json:"DataConverter"`

	DataCells       [][]interface{}          `json:"DataCells"`
	DataObjectCells []map[string]interface{} `json:"DataObjectCells"`

	Footer string `json:"Footer"`
}

func (*TableBase) HTML

func (table *TableBase) HTML(respWriter io.Writer) error

func (*TableBase) HTMLBaseType

func (table *TableBase) HTMLBaseType() reflect.Type

type Templater

type Templater interface {
	HTML(writer io.Writer) error

	HTMLBaseType() reflect.Type
	GetHTMLBase() interface{}
	SetHTMLBase(datas interface{})

	SetRawData(datas interface{})
	GetRawData() interface{}

	GetSmtp() *Smtp
	GetNetwork() *Network
	GetConverter() *Converter

	Merge(highWeight, lowWeight interface{}) interface{}
}

type TemplaterHandleFunc

type TemplaterHandleFunc func(w http.ResponseWriter, r *http.Request) Templater

func IndexTemplateHTML

func IndexTemplateHTML(APIName string, templateType reflect.Type) TemplaterHandleFunc

func IndexTemplateNetwork

func IndexTemplateNetwork(APIName string, templateType reflect.Type) TemplaterHandleFunc

func IndexTemplateNetworkSmtp

func IndexTemplateNetworkSmtp(APIName string, templateType reflect.Type) TemplaterHandleFunc

func IndexTemplateSMTP

func IndexTemplateSMTP(APIName string, templateType reflect.Type) TemplaterHandleFunc

type Timeline

type Timeline struct {
	Utils         `json:"Utils"`
	*TimelineBase `json:"TimelineBase"`
}

func (*Timeline) GetHTMLBase

func (timeline *Timeline) GetHTMLBase() interface{}

func (*Timeline) SetHTMLBase

func (timeline *Timeline) SetHTMLBase(data interface{})

type TimelineBase

type TimelineBase struct {
	Title    string `json:"Title"`
	Overview string `json:"Overview"`

	DataConverter   map[string]string        `json:"DataConverter"`
	TimeFields      []string                 `json:"TimeFields"`
	HeaderCellsMap  map[string]string        `json:"HeaderCellsMap"`
	DataObjectCells []map[string]interface{} `json:"DataObjectCells"`

	Footer string `json:"Footer"`
}

func (*TimelineBase) HTML

func (timeline *TimelineBase) HTML(respWriter io.Writer) error

func (*TimelineBase) HTMLBaseType

func (timeline *TimelineBase) HTMLBaseType() reflect.Type

type Utils

type Utils struct {
	RawData `json:"-"`

	Smtp      `json:"Smtp"`
	Network   `json:"Network"`
	Converter `json:"Converter"`
}

func (*Utils) Merge

func (u *Utils) Merge(highWeight, lowWeight interface{}) interface{}

Jump to

Keyboard shortcuts

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