models

package
v0.0.0-...-6899a59 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: Apache-2.0 Imports: 15 Imported by: 8

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/Mariadb database dbName: ProxyPool dbTableName: ip select distinct if(exists(select * from ProxyPool.ip where type1='https'),1,0) as a from ProxyPool.ip;

func Update

func Update(ip *IP) error

Update the Ip

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 unique" json:"ip"`
	Type1      string    `xorm:"NOT NULL" json:"type1"`
	Type2      string    `xorm:"NULL" json:"type2,omitempty"`
	Speed      int64     `xorm:"NOT NULL" json:"speed,omitempty"`  //连接速度
	Source     string    `xorm:"NOT NULL" json:"source,omitempty"` //代理来源
	CreateTime time.Time `xorm:"NOT NULL" json:"-"`
	UpdateTime time.Time `xorm:"NOT NULL" json:"-"`
}

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