model

package
v0.0.0-...-e1a0380 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Wildcard                    string = "*"
	TypeField                   string = "type"
	DataField                   string = "data"
	TokenField                  string = "token"
	HrefField                   string = "href"
	SourceName                  string = "name"
	SourceUrl                   string = "url"
	SourceTotalSections         string = "total_sections"
	SourceLastUpdate            string = "last_update"
	SourceMeta                  string = "meta"
	SourceMetaTitle             string = "meta_title"
	SourceMetaDescription       string = "meta_description"
	SourceMetaTwitter           string = "meta_twitter"
	SourceMetaUrl               string = "meta_url"
	SourceMetaLocale            string = "meta_locale"
	SourcePageText              string = "text"
	SourcePageLinks             string = "links"
	SourcePageLink              string = "link"
	SourcePageSitemap           string = "sitemap"
	SourcePageSitemapUrl        string = "sitemap_url"
	SourcePageSitemapLastMod    string = "sitemap_lastmod"
	SourcePageSitemapChangeFreq string = "sitemap_changefreq"
)
View Source
const (
	EqualOperator Operator = iota
	LikeOperator
	NotLikeOperator
	AndOperator
	OrOperator
	StringType Type = iota
	TokenType
	TextTokenType
	ErrorTokenType
	StartTagTokenType
	EndTagTokenType
	SelfClosingTagTokenType
	CommentTokenType
	DocTypeTokenType
	SelectType QueryType = iota
	CreateType
	ShowSources
)
View Source
const (
	CreateSource string = "create source"
)

Variables

View Source
var AttributeFields = common.NewStringSlice(HrefField)

Functions

func GetTokenType

func GetTokenType(value string) html.TokenType

Types

type Attributes

type Attributes struct {
	// contains filtered or unexported fields
}

func NewAttributes

func NewAttributes(attributes []html.Attribute) *Attributes

func (*Attributes) Get

func (s *Attributes) Get(key string) string

type ExpressionNode

type ExpressionNode struct {
	Key   *ExpressionNodeKey
	Left  *ExpressionNode
	Right *ExpressionNode
}

func (*ExpressionNode) GetKey

func (n *ExpressionNode) GetKey() string

func (*ExpressionNode) GetOperator

func (n *ExpressionNode) GetOperator() Operator

func (*ExpressionNode) GetType

func (n *ExpressionNode) GetType() Type

func (*ExpressionNode) Insert

func (n *ExpressionNode) Insert(key string)

func (*ExpressionNode) IsComparisonOperatorNode

func (n *ExpressionNode) IsComparisonOperatorNode() bool

func (*ExpressionNode) IsInode

func (n *ExpressionNode) IsInode() bool

func (*ExpressionNode) IsLogicalOperatorNode

func (n *ExpressionNode) IsLogicalOperatorNode() bool

func (*ExpressionNode) IsValueFieldNode

func (n *ExpressionNode) IsValueFieldNode() bool

type ExpressionNodeKey

type ExpressionNodeKey struct {
	Value    string
	Type     Type
	Operator Operator
}

type ExpressionTree

type ExpressionTree struct {
	Root *ExpressionNode
}

func (*ExpressionTree) GetParamNode

func (t *ExpressionTree) GetParamNode(node *ExpressionNode) *ExpressionNode

func (*ExpressionTree) InOrderPrint

func (t *ExpressionTree) InOrderPrint(node *ExpressionNode)

func (*ExpressionTree) Insert

func (t *ExpressionTree) Insert(key string)

func (*ExpressionTree) Match

func (t *ExpressionTree) Match(node *ExpressionNode, section *Section) bool

type Meta

type Meta struct {
	Title       string
	Url         string
	Description string
	Twitter     string
	Locale      string
	SiteMap     *SiteMap
}

func NewMeta

func NewMeta() *Meta

func (*Meta) AddSitemap

func (m *Meta) AddSitemap(sitemap *SiteMap)

func (*Meta) AddSitemapUrl

func (m *Meta) AddSitemapUrl(url *SiteMapUrl)

func (*Meta) IsCompleted

func (m *Meta) IsCompleted() bool

type Operator

type Operator int32

func GetOperator

func GetOperator(value string) Operator

type Page

type Page struct {
	Meta     *Meta
	Sections []*Section
}

func NewPage

func NewPage() *Page

func (*Page) AddSection

func (p *Page) AddSection(section *Section)

type Query

type Query struct {
	Source     string
	Url        string
	Schedule   string
	Fields     *common.StringSlice
	QueryType  QueryType
	Distinct   bool
	Expression *ExpressionTree
}

func NewQuery

func NewQuery() *Query

func (*Query) InOrderPrint

func (q *Query) InOrderPrint()

func (*Query) Match

func (q *Query) Match(section *Section) bool

type QueryResults

type QueryResults struct {
	Sources []*Source
	Page    *Page
}

type QueryType

type QueryType int32

type Section

type Section struct {
	Links []string
	Text  string
}

func NewSection

func NewSection() *Section
func (s *Section) AddLink(link string)

type SiteMap

type SiteMap struct {
	Sites []*SiteMapUrl `xml:"url"`
}

func NewSitemap

func NewSitemap() *SiteMap

type SiteMapUrl

type SiteMapUrl struct {
	Loc        string    `xml:"loc"`
	Lastmod    time.Time `xml:"lastmod"`
	ChangeFreq string    `xml:"changefreq"`
	Priority   float32   `xml:"priority"`
}

type Source

type Source struct {
	Name       string
	Url        string
	Page       *Page
	LastUpdate time.Time
}

type Type

type Type int32

func GetTokenTypeFrom

func GetTokenTypeFrom(tokenType html.TokenType) Type

Jump to

Keyboard shortcuts

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