wsmsg

package
v0.0.0-...-593c55d Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Custom = "2006-01-02 15:04:05"
)

Variables

View Source
var (
	ErrOpenCode = errors.New("开奖号码有误")
	ErrExists   = errors.New("号码已存在")
)

Functions

func SetLogger

func SetLogger(lg *log.Logger)

Types

type ApiWs

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

func NewApiWs

func NewApiWs(openers []LtOpener, cfg ...*Config) *ApiWs

func (*ApiWs) Client

func (w *ApiWs) Client() *wslt.Client

func (*ApiWs) Run

func (w *ApiWs) Run()

func (*ApiWs) SetHandler

func (w *ApiWs) SetHandler(key string, value wslt.ClientBusinessHandler)

type BaseModel

type BaseModel struct {
	ID      int64    `json:"id,omitempty" xorm:"autoincr pk"`
	Created JSONTime `json:"created,omitempty" xorm:"notnull created index"`
	Updated JSONTime `json:"updated,omitempty" xorm:"notnull updated index"`
	Version int64    `json:"version,omitempty" xorm:"notnull version index"`
}

type Config

type Config struct {
	ApiUrl string
	Secret string

	ReconnectWait time.Duration

	UserDefaultHandler bool
}

type JSONTime

type JSONTime time.Time

JSONTime ...

func ToDatetime

func ToDatetime(in string) (JSONTime, error)

ToDatetime ...

func (*JSONTime) GobDecode

func (p *JSONTime) GobDecode(data []byte) error

GobDecode implements the gob.GobDecoder interface.

func (JSONTime) GobEncode

func (p JSONTime) GobEncode() ([]byte, error)

GobEncode implements the gob.GobEncoder interface.

func (JSONTime) MarshalJSON

func (p JSONTime) MarshalJSON() ([]byte, error)

MarshalJSON ...

func (*JSONTime) Scan

func (p *JSONTime) Scan(v interface{}) error

Scan valueof time.Time

func (JSONTime) String

func (p JSONTime) String() string

String ...

func (*JSONTime) UnmarshalJSON

func (p *JSONTime) UnmarshalJSON(data []byte) error

UnmarshalJSON ...

func (JSONTime) Value

func (p JSONTime) Value() (driver.Value, error)

Value insert timestamp into mysql need this function.

type LtOpener

type LtOpener interface {
	HasOpenCode(*OpenData) bool
	AfterGetOpenCode(*OpenData)
	LtName() string
}

type OpenData

type OpenData struct {
	BaseModel `xorm:"extends"`

	OtherData interface{} `json:"other_data" xorm:"-"`

	LotName   string `json:"lot_name" xorm:"-"`
	LotNameCN string `json:"lot_name_cn" xorm:"-"`

	Gid int64 `json:"gid" xorm:"notnull index comment(彩种ID)"`
	//开奖期号
	Issue string `json:"issue" xorm:"varchar(20) notnull index comment(开奖期号)"`
	//开奖号码
	OpenCode string `json:"open_code" xorm:"varchar(200) notnull comment(开奖号码)"`
	//开奖时间
	OpenTime JSONTime `json:"open_time" xorm:"notnull comment(开奖时间)"`
	//开奖时间戳
	OpenTimestamp int64 `json:"open_timestamp" xorm:"notnull comment(开奖时间戳)"`
	//下期开奖期号
	NextIssue string `json:"next_issue" xorm:"varchar(20) notnull comment(下期开奖期号)"`

	NextOpenTime JSONTime `json:"next_open_time" xorm:"notnull comment(下期开奖时间)"`

	NextOpenTimestamp int64 `json:"next_open_timestamp" xorm:"notnull comment(下期开奖时间戳)"`

	FromSourceID int `json:"from_source_id" xorm:"notnull comment(采集源类型ID)"`
}

Jump to

Keyboard shortcuts

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