models

package
v0.0.0-...-452813b Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2018 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HasEngine bool

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

Functions

func CountIPs

func CountIPs() int64

func DeleteIP

func DeleteIP(ip *IP) error

func InsertIps

func InsertIps(ip *IP) (err error)

SaveIps save ips info to database

func LoadDatabaseInfo

func LoadDatabaseInfo()

func NewEngine

func NewEngine() (err error)

func NewTestEngine

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

func SetEngine

func SetEngine() (err error)

func Update

func Update(ip IP) error

Types

type Engine

type Engine interface {
	Delete(interface{}) (int64, error)
	Exec(string, ...interface{}) (sql.Result, 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
	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"`
}

IP struct

func FindAll

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

func GetAll

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

func GetOne

func GetOne(ip string) *IP

func NewIP

func NewIP() *IP

NewIP .

Jump to

Keyboard shortcuts

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