ToolGood

package module
v0.0.0-...-92c577d Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

README

ToolGood

Documentation

Index

Constants

View Source
const BlackListCollection = "blacklist"
View Source
const ID = "_id"
View Source
const KeywordBson = "keyword"
View Source
const KeywordsCollection = "keywords"

Variables

This section is empty.

Functions

func LoadField

func LoadField[T any](Mongo *mongo.Database, collectionName string, typeJson string) ([]T, error)

Types

type BlackList

type BlackList struct {
	Id    string `bson:"_id"`
	Black string `bson:"black"`
}

type IllegalWordsSearch

type IllegalWordsSearch struct {
	tool.BaseSearchEx
	UseSkipWordFilter bool

	UseDuplicateWordFilter bool
	UseBlacklistFilter     bool

	UseDBCcaseConverter           bool
	UseSimplifiedChineseConverter bool
	UseIgnoreCase                 bool
	// contains filtered or unexported fields
}

func NewIllegalWordsSearch

func NewIllegalWordsSearch() *IllegalWordsSearch

func (*IllegalWordsSearch) ContainsAny

func (this *IllegalWordsSearch) ContainsAny(text string) bool

func (*IllegalWordsSearch) ContainsAny2

func (this *IllegalWordsSearch) ContainsAny2(text string, flag int) bool

func (*IllegalWordsSearch) CreateCollection

func (this *IllegalWordsSearch) CreateCollection() error

func (*IllegalWordsSearch) FindAll

func (this *IllegalWordsSearch) FindAll(text string) []*IllegalWordsSearchResult

在文本中查找所有的关键字

func (*IllegalWordsSearch) FindAll2

func (this *IllegalWordsSearch) FindAll2(text string, flag int) []*IllegalWordsSearchResult

func (*IllegalWordsSearch) FindFirst

func (this *IllegalWordsSearch) FindFirst(text string) *IllegalWordsSearchResult

func (*IllegalWordsSearch) FindFirst2

func (this *IllegalWordsSearch) FindFirst2(text string, flag int) *IllegalWordsSearchResult

func (*IllegalWordsSearch) Load2

func (this *IllegalWordsSearch) Load2(f *os.File)

func (*IllegalWordsSearch) LoadData

func (this *IllegalWordsSearch) LoadData()

func (*IllegalWordsSearch) LoadFromDB

func (this *IllegalWordsSearch) LoadFromDB(config *MongoConfig)

func (*IllegalWordsSearch) Replace

func (this *IllegalWordsSearch) Replace(text string, replaceChar rune) string

func (*IllegalWordsSearch) Replace2

func (this *IllegalWordsSearch) Replace2(text string, replaceChar rune, flag int) string

func (*IllegalWordsSearch) Save2

func (this *IllegalWordsSearch) Save2(f *os.File)

func (*IllegalWordsSearch) SetBlacklist

func (this *IllegalWordsSearch) SetBlacklist(blacklist []int) error

func (*IllegalWordsSearch) SetKeywords

func (this *IllegalWordsSearch) SetKeywords(keywords []string)

func (*IllegalWordsSearch) SetSkipWords

func (this *IllegalWordsSearch) SetSkipWords(skipList string)

type IllegalWordsSearchResult

type IllegalWordsSearchResult struct {
	Start         int
	End           int
	Keyword       string
	BlacklistType int
	SrcString     string
}

func NewIllegalWordsSearchResult

func NewIllegalWordsSearchResult(keyword string, start int, end int, srcText string, _type int) *IllegalWordsSearchResult

type Keywords

type Keywords struct {
	Id      string `bson:"_id"`
	Keyword string `bson:"keyword"`
}

type MongoConfig

type MongoConfig struct {
	DataSource string
	DB         string
}

type StringSearch

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

func NewStringSearch

func NewStringSearch() *StringSearch

func (*StringSearch) ContainsAny

func (this *StringSearch) ContainsAny(text string) bool

func (*StringSearch) FindAll

func (this *StringSearch) FindAll(text string) []string

func (*StringSearch) FindFirst

func (this *StringSearch) FindFirst(text string) string

func (*StringSearch) Replace

func (this *StringSearch) Replace(text string, replaceChar int32) string

func (*StringSearch) SetKeywords

func (this *StringSearch) SetKeywords(keywords []string)

type StringSearchEx

type StringSearchEx struct {
	tool.BaseSearchEx
}

func NewStringSearchEx

func NewStringSearchEx() *StringSearchEx

func (*StringSearchEx) ContainsAny

func (this *StringSearchEx) ContainsAny(text string) bool

func (*StringSearchEx) FindAll

func (this *StringSearchEx) FindAll(text string) []string

func (*StringSearchEx) FindFirst

func (this *StringSearchEx) FindFirst(text string) string

func (*StringSearchEx) Replace

func (this *StringSearchEx) Replace(text string, replaceChar rune) string

type WordsSearch

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

func NewWordsSearch

func NewWordsSearch() *WordsSearch

func (*WordsSearch) ContainsAny

func (this *WordsSearch) ContainsAny(text string) bool

func (*WordsSearch) FindAll

func (this *WordsSearch) FindAll(text string) []*WordsSearchResult

func (*WordsSearch) FindFirst

func (this *WordsSearch) FindFirst(text string) *WordsSearchResult

func (*WordsSearch) Replace

func (this *WordsSearch) Replace(text string, replaceChar int32) string

func (*WordsSearch) SetKeywords

func (this *WordsSearch) SetKeywords(keywords []string)

type WordsSearchEx

type WordsSearchEx struct {
	tool.BaseSearchEx
}

func NewWordsSearchEx

func NewWordsSearchEx() *WordsSearchEx

func (*WordsSearchEx) ContainsAny

func (this *WordsSearchEx) ContainsAny(text string) bool

func (*WordsSearchEx) FindAll

func (this *WordsSearchEx) FindAll(text string) []*WordsSearchResult

func (*WordsSearchEx) FindFirst

func (this *WordsSearchEx) FindFirst(text string) *WordsSearchResult

func (*WordsSearchEx) Replace

func (this *WordsSearchEx) Replace(text string, replaceChar rune) string

type WordsSearchResult

type WordsSearchResult struct {
	Start   int
	End     int
	Keyword string
	Index   int
}

func NewWordsSearchResult

func NewWordsSearchResult(keyword string, start int, end int, index int) *WordsSearchResult

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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