store

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2016 License: Apache-2.0 Imports: 9 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// DefaultCollection 默认存储敏感词的集合
	DefaultCollection = "dirties"
)
View Source
const (
	// DefaultDelim 默认读取敏感词的分隔符
	DefaultDelim = '\n'
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryConfig

type MemoryConfig struct {
	// Reader 敏感词数据源
	Reader io.Reader
	// Delim 读取数据的分隔符
	Delim byte
	// DataSource 敏感词数据源
	DataSource []string
}

MemoryConfig 敏感词内存存储配置

type MemoryStore

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

MemoryStore 提供内存存储敏感词

func NewMemoryStore

func NewMemoryStore(config MemoryConfig) (*MemoryStore, error)

NewMemoryStore 创建敏感词内存存储

func (*MemoryStore) Read

func (ms *MemoryStore) Read() <-chan string

Read Read

func (*MemoryStore) ReadAll

func (ms *MemoryStore) ReadAll() ([]string, error)

ReadAll ReadAll

func (*MemoryStore) Remove

func (ms *MemoryStore) Remove(words ...string) error

Remove Remove

func (*MemoryStore) Version

func (ms *MemoryStore) Version() uint64

Version Version

func (*MemoryStore) Write

func (ms *MemoryStore) Write(words ...string) error

Write Write

type MongoConfig

type MongoConfig struct {
	// URL MongoDB连接字符串
	URL string
	// Session 当前会话
	Session *mgo.Session
	// DB 存储敏感词的数据库名称(默认使用会话提供的默认DB)
	DB string
	// Collection 存储敏感词的集合名称
	Collection string
}

MongoConfig 敏感词MongoDB存储配置

type MongoStore

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

MongoStore 提供内存存储敏感词

func NewMongoStore

func NewMongoStore(config MongoConfig) (*MongoStore, error)

NewMongoStore 创建敏感词MongoDB存储

func (*MongoStore) Read

func (ms *MongoStore) Read() <-chan string

Read Read

func (*MongoStore) ReadAll

func (ms *MongoStore) ReadAll() ([]string, error)

ReadAll ReadAll

func (*MongoStore) Remove

func (ms *MongoStore) Remove(words ...string) error

Remove Remove

func (*MongoStore) Version

func (ms *MongoStore) Version() uint64

Version Version

func (*MongoStore) Write

func (ms *MongoStore) Write(words ...string) error

Write Write

Jump to

Keyboard shortcuts

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