utils

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Name                 = "gseo"
	DefaultConfigSubDir  = ".gseo"
	DefaultConfigPath    = "$HOME/.gseo"
	DefaultCfgFileName   = "config.yaml"
	DefaultTokenFileName = "token.json"
)

Variables

This section is empty.

Functions

func EId

func EId() string

func GetCacheFile

func GetCacheFile() string

func GetClientSecretPath

func GetClientSecretPath() string

func GetHome

func GetHome() string

func GetMarkdownFileByURL

func GetMarkdownFileByURL(permalink, contentPath string) (path string, err error)

func GetTokenPath

func GetTokenPath() string

func IsContain

func IsContain(items []string, item string) bool

func IsDir

func IsDir(path string) bool

func IsFile

func IsFile(path string) bool

func LastDate

func LastDate(last int) string

LastDate last x day date

func ParserSearchAnalyticsQuery

func ParserSearchAnalyticsQuery(rows []*searchconsole.ApiDataRow) map[string]map[string]*KeywordItem

ParserSearchAnalyticsQuery parser "PAGE" and "QUERY" Dimensions Query Response

func ReadFromCmd

func ReadFromCmd(tips string) (string, error)

func RunCommand

func RunCommand(cmd string) (string, error)

RunCommand is a shared function used by check and reload to run the given command. It returns nil if the given cmd returns 0. The command can be run on unix and windows.

func SortKeywords added in v1.0.2

func SortKeywords(input map[string]*KeywordItem) []string

SortKeywords return sort keywords list by Ctr > Clicks > Position > Impressions, order by value desc

func SortMap

func SortMap(m map[string]float64) []string

func TodayDate

func TodayDate() string

func UpdateKeywords

func UpdateKeywords(filename string, keywords []string) error

Types

type ByValue added in v1.0.2

type ByValue struct{ KeywordItems }

ByValue implements sort.Interface by providing Less and using the Len and Swap methods of the embedded KeywordItems value.

func (ByValue) Less added in v1.0.2

func (v ByValue) Less(i, j int) bool

Less sort keywords KeywordItems[i]/KeywordItems[j] by Ctr > Clicks > Position > Impressions, order by value desc

type KeywordItem

type KeywordItem struct {
	Keyword     string  `json:"-"`
	Ctr         float64 `json:"ctr"`
	Clicks      float64 `json:"clicks"`
	Position    float64 `json:"position"`
	Impressions float64 `json:"impressions"`
}

type KeywordItems added in v1.0.2

type KeywordItems []*KeywordItem

func (KeywordItems) Len added in v1.0.2

func (k KeywordItems) Len() int

func (KeywordItems) Swap added in v1.0.2

func (k KeywordItems) Swap(i, j int)

type PostYaml

type PostYaml struct {
	Keywords []string `json:"keywords"`
	Tags     []string `json:"tags"`
}

func ParsePostKeysAndTags

func ParsePostKeysAndTags(filename string) (*PostYaml, error)

Jump to

Keyboard shortcuts

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