Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeywordSet ¶
type KeywordSet struct { Keywords map[string]bool // the key is the keyword. Successes map[string]keywordSuccess // the key is the keyword. Fails map[string]keywordFail // the key is the keyword. }
KeywordSet is kind a Set Data Structure implementation. It has an Add method that only works if the Keyword doesn't exist already.
When you use it, firstly create with NewKeywordSet method. Example: k := NewKeywordSet() k.Add(
"boratanrikulu blog yazıları",
)
You can access by using keyword string output, like that: k.Keywords["boratanrikulu blog yazıları"]
func (*KeywordSet) Add ¶
func (k *KeywordSet) Add(keywords ...string) error
Add method adds new keywords if it is doesn't already exist.
func (*KeywordSet) AddFail ¶
func (k *KeywordSet) AddFail(keyword string, reason string)
AddFail adds the keyword to the fail list with a reason, if it doesn't exist already.
func (*KeywordSet) AddSuccess ¶
func (k *KeywordSet) AddSuccess(keyword string, results []KeywordSuccessResult)
AddSuccess adds the result to the success list, if it doesn't exist already.
func (*KeywordSet) ToStringSlice ¶
func (kw *KeywordSet) ToStringSlice() []string
ToStringSlice create a string slice that includes all Keywords.
type KeywordSuccessResult ¶
KeywordSuccessResults keeps the result for success elements. It is exported to use in services package.
type URLSet ¶
type URLSet struct { URLs map[string]url // the key is url.String() (BaseURL + Keywords). Successes map[string]urlSuccess // the key is the Original URL. Fails map[string]urlFail // the key is the Original URL. }
URLSet is kind a Set Data Structure implementation. It has an Add method that only works if the URL doesn't exist already. Also, It is able to split the url to FullURL, BaseURL and Keywords. If there is an error, add it to the fail list. (only adds when the fail info doesn't exist already.)
When you use it, firstly create with NewURLSet method. Example: s := NewURLSet() s.Add(
"https://boratanrikulu.dev/postgresql-nedir-nasil-calisir/", "https://boratanrikulu.dev/smtp-nasil-calisir-ve-postfix-kurulumu/",
)
You can access by using string output, like that: s.URLs["boratanrikulu.dev postgresql nedir nasil calisir"].BaseURL
func (*URLSet) Add ¶
Add method adds new URLs if it is doesn't exist already. Also, It splits the url to FullURL, BaseURL and Keywords. It except only valid URLs. If there is an issue with the given URL, It adds it to the fail list with a reason.
func (*URLSet) AddFail ¶
AddFail adds the url to the fail list with a reason, if it doesn't exist already.
func (*URLSet) AddSuccess ¶
AddSuccess adds the result to the success list, if it doesn't exist already.
func (*URLSet) ToStringSlice ¶
ToStringSlice create a string slice that includes all URLs.