db

package
v0.0.0-...-fb1bee7 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: Apache-2.0 Imports: 9 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"
)

Variables

This section is empty.

Functions

func QuoteWithCountByDate

func QuoteWithCountByDate(ctx context.Context, exec mysql.Exec, kind string, date string) (int64, error)

func QuoteWithDeleteManyByCodesAndDate

func QuoteWithDeleteManyByCodesAndDate(ctx context.Context, exec mysql.Exec, kind string, codes []string, date string) (int64, error)

func QuoteWithInsertMany

func QuoteWithInsertMany(ctx context.Context, exec mysql.Exec, kind string, data []*Quote) (int64, error)

func QuoteWithSelectBetweenByCodesAndDate

func QuoteWithSelectBetweenByCodesAndDate(ctx context.Context, exec mysql.Exec, kind string, codes []string, begin, end string) (map[string][]*Quote, error)

func StockWithInsertMany

func StockWithInsertMany(ctx context.Context, exec mysql.Exec, stocks []*Stock) (int64, error)

func StockWithInsertOrUpdateMany

func StockWithInsertOrUpdateMany(ctx context.Context, exec mysql.Exec, stocks []*Stock) (int64, error)

func StockWithSelectMany

func StockWithSelectMany(ctx context.Context, exec mysql.Exec, codes []string) (map[string]*Stock, error)

func StockWithUpdateOne

func StockWithUpdateOne(ctx context.Context, exec mysql.Exec, code string, stock *Stock) (int64, error)

Types

type Quote

type Quote struct {
	Id              string       `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(ctx context.Context, exec mysql.Exec, kind string, code string, begin, end string) ([]*Quote, error)

func QuoteWithSelectLatestByCodeAndDate

func QuoteWithSelectLatestByCodeAndDate(ctx context.Context, exec mysql.Exec, kind string, code string, date string, limit int64) ([]*Quote, error)

func QuoteWithSelectLatestByCodesAndDate

func QuoteWithSelectLatestByCodesAndDate(ctx context.Context, exec mysql.Exec, kind string, code []string, date string) ([]*Quote, error)

func QuoteWithSelectOneByCodeAndDate

func QuoteWithSelectOneByCodeAndDate(ctx context.Context, exec mysql.Exec, kind string, code string, date string) (*Quote, error)

func QuoteWithSelectRangeByDate

func QuoteWithSelectRangeByDate(ctx context.Context, exec mysql.Exec, kind string, date string, offset, limit int64) ([]*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(ctx context.Context, exec mysql.Exec, offset, limit int64) ([]*Stock, error)

func (*Stock) String

func (s *Stock) String() string

Jump to

Keyboard shortcuts

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