models

package
v0.0.0-...-f6e951e Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// HasEngine .
	HasEngine bool

	DbCfg struct {
		Type, Host, Name, User, Passwd, Path, SSLMode string
	}
	EnableSQLite3 bool
)

Functions

func CountIPs

func CountIPs() int64

CountIPs .

func DeleteIP

func DeleteIP(ip *IP) error

DeleteIP .

func InsertIps

func InsertIps(ip *IP) (err error)

InsertIps SaveIps save ips info to database

func LoadDatabaseInfo

func LoadDatabaseInfo()

LoadDatabaseInfo .

func NewEngine

func NewEngine() (err error)

NewEngine .

func NewTestEngine

func NewTestEngine(x *xorm.Engine) (err error)

NewTestEngine .

func SetEngine

func SetEngine() (err error)

SetEngine .

func TestHttps

func TestHttps() bool

Test if have https proxy in database just test on mysql database dbName: ProxyPool dbTableName: ip select distinct if(exists(select * from ip where type2='https'),1,0) as a from ip;

func Update

func Update(ip IP) error

Update .

Types

type Engine

type Engine interface {
	Delete(interface{}) (int64, error)
	Exec(string, ...interface{}) (sql.Result, error)
	Exist(...interface{}) (bool, error)
	Find(interface{}, ...interface{}) error
	Get(interface{}) (bool, error)
	Id(interface{}) *xorm.Session
	In(string, ...interface{}) *xorm.Session
	Insert(...interface{}) (int64, error)
	InsertOne(interface{}) (int64, error)
	Iterate(interface{}, xorm.IterFunc) error
	Query(string, ...interface{}) (sql.Result, error)
	Sql(string, ...interface{}) *xorm.Session
	Table(interface{}) *xorm.Session
	Where(interface{}, ...interface{}) *xorm.Session
}

Engine represents a XORM engine or session.

type IP

type IP struct {
	ID    int64  `xorm:"pk autoincr" json:"-"`
	Data  string `xorm:"NOT NULL" json:"ip"`
	Type1 string `xorm:"NOT NULL" json:"type1"`
	Type2 string `xorm:"NULL" json:"type2,omitempty"`
	Speed int64  `xorm:"NOT NULL" json:"speed,omitempty"`
}

IP struct

func FindAll

func FindAll(value string) ([]*IP, error)

FindAll .

func GetAll

func GetAll() ([]*IP, error)

GetAll .

func GetOne

func GetOne(ip string) *IP

GetOne .

func NewIP

func NewIP() *IP

NewIP .

Jump to

Keyboard shortcuts

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