blog

package
v0.0.0-...-b155b17 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package blog implements blog tasks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert2WrodsMap

func Convert2WrodsMap(c *chaining.Chain) (interface{}, error)

func FilterDiscardWords

func FilterDiscardWords(c *chaining.Chain) (interface{}, error)

func FilterFmt

func FilterFmt(c *chaining.Chain) (interface{}, error)

func FilterMinimalWordsCount

func FilterMinimalWordsCount(minialCount int) func(c *chaining.Chain) (interface{}, error)

func FilterMostFreqWords

func FilterMostFreqWords(topN int) func(c *chaining.Chain) (interface{}, error)

Types

type Analyser

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

func NewAnalyser

func NewAnalyser() *Analyser

func (*Analyser) Cut2Words

func (a *Analyser) Cut2Words(cnt string, minialCount, topN int) (words []string)

type Blog

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

func NewBlogDB

func NewBlogDB(ctx context.Context, addr, dbName, user, pwd, postColName, keywordColName string) (b *Blog, err error)

func (*Blog) Close

func (b *Blog) Close(ctx context.Context)

func (*Blog) GetPostIter

func (b *Blog) GetPostIter(ctx context.Context) (*mongoLib.Cursor, error)

func (*Blog) LoadAllPostsCnt

func (b *Blog) LoadAllPostsCnt(ctx context.Context) (cnt string, err error)

func (*Blog) UpdatePostTagsByID

func (b *Blog) UpdatePostTagsByID(ctx context.Context, bid primitive.ObjectID, tags []string) (err error)

type Post

type Post struct {
	ID        primitive.ObjectID `bson:"_id"`
	Cnt       string             `bson:"post_content"`
	Title     string             `bson:"post_title"`
	Name      string             `bson:"post_name"`
	CreatedAt time.Time          `bson:"post_created_at"`
}

type RssWorker

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

RssWorker rss worker

func NewRssWorker

func NewRssWorker(blogdb *Blog) (*RssWorker, error)

NewRssWorker create rss worker

func (*RssWorker) GenerateRSS

func (w *RssWorker) GenerateRSS(ctx context.Context, rsscfg *rssCfg) (err error)

GenerateRSS scan all posts and generate rss

func (*RssWorker) Write2File

func (w *RssWorker) Write2File(fpath string) (err error)

Write2File write rss to file

func (*RssWorker) Write2S3

func (w *RssWorker) Write2S3(ctx context.Context,
	endpoint,
	accessKey,
	accessSecret,
	bucket,
	objKey string,
) error

Write2S3 write rss to s3

Jump to

Keyboard shortcuts

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