model

package
v0.0.0-...-85547db Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Day  = "day"
	Week = "week"
)
View Source
const (
	FieldQuoteID              = "id"
	FieldQuoteCode            = "code"
	FieldQuoteOpen            = "open"
	FieldQuoteClose           = "close"
	FieldQuoteHigh            = "high"
	FieldQuoteLow             = "low"
	FieldQuoteYesterdayClosed = "yesterday_closed"
	FieldQuoteVolume          = "volume"
	FieldQuoteAccount         = "account"
	FieldQuoteDate            = "date"
	FieldQuoteNumOfYear       = "num_of_year"
	FieldQuoteXd              = "xd"
	FieldQuoteCreateTimestamp = "create_timestamp"
	FieldQuoteModifyTimestamp = "modify_timestamp"
)
View Source
const (
	FieldStockCode            = "code"
	FieldStockName            = "name"
	FieldStockSuspend         = "suspend"
	FieldStockCreateTimestamp = "create_timestamp"
	FieldStockModifyTimestamp = "modify_timestamp"
)
View Source
const (
	TypeStock = "stock"
	TypeDay   = "day"
	TypeWeek  = "week"
)
View Source
const (
	FieldTaskRecordID              = "id"
	FieldTaskRecordCompleted       = "completed"
	FieldTaskRecordCount           = "`count`"
	FieldTaskRecordType            = "`type`"
	FieldTaskRecordDate            = "`date`"
	FieldTaskRecordPriority        = "priority"
	FieldTaskRecordCreateTimestamp = "create_timestamp"
	FieldTaskRecordModifyTimestamp = "modify_timestamp"
)

Variables

This section is empty.

Functions

func Check

func Check(data *Metadata) bool

func QuoteWithDeleteManyByCodesAndDate

func QuoteWithDeleteManyByCodesAndDate(exec mysql.Exec, model string, codes []string, date string, timeout time.Duration) (int64, error)

func QuoteWithInsertMany

func QuoteWithInsertMany(exec mysql.Exec, model string, data []*Quote, timeout time.Duration) (int64, error)

func StockWithInsertMany

func StockWithInsertMany(exec mysql.Exec, stocks []*Stock, timeout time.Duration) (int64, error)

func StockWithInsertOrUpdateMany

func StockWithInsertOrUpdateMany(exec mysql.Exec, stocks []*Stock, timeout time.Duration) (int64, error)

func StockWithSelectMany

func StockWithSelectMany(exec mysql.Exec, codes []string, timeout time.Duration) (map[string]*Stock, error)

func StockWithUpdateOne

func StockWithUpdateOne(exec mysql.Exec, code string, stock *Stock, timeout time.Duration) (int64, error)

func TaskRecordWithDeleteManyByDate

func TaskRecordWithDeleteManyByDate(exec mysql.Exec, date string, timeout time.Duration) (int64, error)

func TaskRecordWithInsertMany

func TaskRecordWithInsertMany(exec mysql.Exec, records []*TaskRecord, timeout time.Duration) (int64, error)

func TaskRecordWithUpdateOneCompleted

func TaskRecordWithUpdateOneCompleted(exec mysql.Exec, count int64, date string, t string, timeout time.Duration) (int64, error)

Types

type Metadata

type Metadata struct {
	ObjectID        string  `json:"_id" bson:"_id"`
	Source          string  `json:"source" bson:"source"`                     // 来源
	Code            string  `json:"code" bson:"code"`                         // 代码
	Name            string  `json:"name" bson:"name"`                         // 名称
	Open            float64 `json:"open" bson:"open"`                         // 开盘价格
	YesterdayClosed float64 `json:"yesterday_closed" bson:"yesterday_closed"` // 昨日收盘价格
	High            float64 `json:"high" bson:"high"`                         // 最高价
	Low             float64 `json:"low" bson:"low"`                           // 最低价
	Latest          float64 `json:"latest" bson:"latest"`                     // 当前价格
	Volume          int64   `json:"volume" bson:"volume"`                     // 成交量
	Account         float64 `json:"account" bson:"account"`                   // 成交额
	Date            string  `json:"date" bson:"date"`                         // 日期
	Time            string  `json:"time" bson:"time"`                         // 时间
	Suspend         string  `json:"suspend" bson:"suspend"`                   // 停盘状态
	CreateTimestamp int64   `json:"create_timestamp" bson:"create_timestamp"` // 创建时间
	ModifyTimestamp int64   `json:"modify_timestamp" bson:"modify_timestamp"` // 修改时间
}

func MetadataWithSelectRange

func MetadataWithSelectRange(db *mongo.Client, offset, limit int64, date string, lastID string, timeout time.Duration) ([]*Metadata, error)

func (*Metadata) String

func (m *Metadata) String() string

type Quote

type Quote struct {
	Id              int64        `json:"id"`
	Code            string       `json:"code"`
	Open            float64      `json:"open"`
	Close           float64      `json:"close"`
	High            float64      `json:"high"`
	Low             float64      `json:"low"`
	YesterdayClosed float64      `json:"yesterday_closed"`
	Volume          int64        `json:"volume"`
	Account         float64      `json:"account"`
	Date            time.Time    `json:"date"`
	NumOfYear       int          `json:"num_of_year"`
	Xd              float64      `json:"xd"`
	CreateTimestamp time.Time    `json:"create_timestamp"`
	ModifyTimestamp sql.NullTime `json:"modify_timestamp"`
}

func QuoteWithSelectBetweenByCodeAndDate

func QuoteWithSelectBetweenByCodeAndDate(exec mysql.Exec, model string, code string, begin, end string, timeout time.Duration) ([]*Quote, error)

func QuoteWithSelectManyLatest

func QuoteWithSelectManyLatest(exec mysql.Exec, model string, code string, date string, limit int64, timeout time.Duration) ([]*Quote, error)

func QuoteWithSelectOneByCodeAndDate

func QuoteWithSelectOneByCodeAndDate(exec mysql.Exec, model string, code string, date string, timeout time.Duration) (*Quote, error)

func QuoteWithSelectRangeByDate

func QuoteWithSelectRangeByDate(exec mysql.Exec, model string, date string, offset, limit int64, timeout time.Duration) ([]*Quote, error)

func (*Quote) String

func (q *Quote) String() string

type Stock

type Stock struct {
	Code            string       `json:"code"`
	Name            string       `json:"name"`
	Suspend         string       `json:"suspend"`
	CreateTimestamp time.Time    `json:"create_timestamp"`
	ModifyTimestamp sql.NullTime `json:"modify_timestamp"`
}

Stock

func StockWithSelectRange

func StockWithSelectRange(exec mysql.Exec, offset, limit int64, timeout time.Duration) ([]*Stock, error)

func (*Stock) String

func (s *Stock) String() string

type TaskRecord

type TaskRecord struct {
	Id              int64        `json:"id"`
	Completed       bool         `json:"completed"`
	Count           int          `json:"count"`
	Type            string       `json:"type"`
	Date            string       `json:"date"`
	Priority        int64        `json:"priority"`
	CreateTimestamp time.Time    `json:"create_timestamp"`
	ModifyTimestamp sql.NullTime `json:"modify_timestamp"`
}

func BuildTaskRecord

func BuildTaskRecord(t time.Time) []*TaskRecord

func TaskRecordWithSelectManyByDate

func TaskRecordWithSelectManyByDate(exec mysql.Exec, date string, timeout time.Duration) ([]*TaskRecord, error)

func (*TaskRecord) String

func (t *TaskRecord) String() string

Jump to

Keyboard shortcuts

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