storage

package
v0.0.0-...-132711c Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = util.NewConfig()

Config 全局配置文件

View Source
var GlobalMgoSession, _ = mgo.Dial(string(Config.Mongo.Addr))

GlobalMgoSession 全局连接Session

Functions

func CheckIP

func CheckIP(ip *models.IP) bool

CheckIP is to check the ip work or not

func CheckProxy

func CheckProxy(ip *models.IP)

CheckProxy .

func CheckProxyDB

func CheckProxyDB()

CheckProxyDB to check the ip in DB

func ProxyAdd

func ProxyAdd(ip *models.IP)

ProxyAdd .

func ProxyDel

func ProxyDel(ip *models.IP)

ProxyDel .

func ProxyFind

func ProxyFind(value string) (ip *models.IP)

ProxyFind .

func ProxyRandom

func ProxyRandom() (ip *models.IP)

ProxyRandom .

Types

type Storage

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

Storage struct is used for storeing persistent data of alerts

func NewStorage

func NewStorage() *Storage

NewStorage creates and returns new Storage instance

func (*Storage) Count

func (s *Storage) Count() int

Count all collections

func (*Storage) Create

func (s *Storage) Create(item interface{}) error

Create insert new item

func (*Storage) Delete

func (s *Storage) Delete(ip *models.IP) error

Delete .

func (*Storage) FindAll

func (s *Storage) FindAll(value string) ([]*models.IP, error)

FindAll .

func (*Storage) GetAll

func (s *Storage) GetAll() ([]*models.IP, error)

GetAll .

func (*Storage) GetDBSession

func (s *Storage) GetDBSession() *mgo.Session

GetDBSession returns a new connection from the pool

func (*Storage) GetOne

func (s *Storage) GetOne(value string) (*models.IP, error)

GetOne Finds and returns one data from storage

func (*Storage) Update

func (s *Storage) Update(ip *models.IP) error

Update .

Jump to

Keyboard shortcuts

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