Documentation
¶
Index ¶
Constants ¶
const ( GrandLotoZipName = "grandloto_201912.zip" GrandLotoNoelZipName = "lotonoel_201703.zip" SuperLoto199605ZipName = "superloto_199605.zip" SuperLoto200810ZipName = "superloto_200810.zip" SuperLoto201703ZipName = "superloto_201703.zip" SuperLoto201907ZipName = "superloto_201907.zip" Loto197605ZipName = "loto_197605.zip" Loto200810ZipName = "loto_200810.zip" Loto201703ZipName = "loto_201703.zip" Loto201902ZipName = "loto_201902.zip" Loto201911ZipName = "loto_201911.zip" )
File names for the different lotto history from the FDJ API
const (
APIBasePath = "https://media.fdj.fr/static/csv/loto"
)
Endpoint to contact the FDJ history service
Variables ¶
var ( ErrInvalidDrawType = errors.New("draw type instance is invalid") ErrInvalidCSVType = errors.New("csv type instance is invalid") ErrInvalidResponseHTTP = errors.New("response http is invalid") ErrInvalidContextDecoder = errors.New("context decoder is invalid") ErrInvalidHTTPRequest = errors.New("http request is invalid") ErrNoContext = errors.New("context is nil") ErrDrawTypeKeyNotFound = errors.New("draw type key not found in the context recorder") )
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
// LoadAPI loads the history source from the FDJ archive
LoadSource(ctx context.Context, source []SourceInfo) error
// DownloadSource downloads the history source from the FDJ archive
DownloadSource(ctx context.Context, path string, source []SourceInfo) error
// SourceUpdatedAt returns the last update time of the history source
SourceUpdatedAt(ctx context.Context, source SourceInfo) (time.Time, error)
// LoadFile loads the history source from a file
// source is used to know the type of the source
// File must be a csv file with ';' separator
LoadFile(path string, source SourceInfo) error
// NDraws returns the number of draws
NDraws(filter Filter) int64
// Draws returns the draws depending on the filter
Draws(filter Filter, order draw.OrderType) []draw.Draw
// Reset resets the draws records
Reset()
}
API is the interface to load the history source. It can load the history source from the FDJ archive or from a file. To get a default api instance, use NewAPI function.
type Filter ¶
type Filter struct {
Day draw.Day
SuperLotto bool
GrandLotto bool
XmasLotto bool
ClassicLotto bool
OldLotto bool
}
Filter is the filter of draw. if day is empty, it will match all day. if old lotto is false, it will not match old lotto, otherwise it will match all. if super lotto is false, it will not match super lotto. if grand lotto is false, it will not match grand lotto. if xmas lotto is false, it will not match xmas lotto. if classic lotto is false, it will not match classic lotto. classic lotto is the default draw type (from november 2019).
type Source ¶
type Source int16
Source is the type of lotto history
type SourceInfo ¶
SourceInfo contains the information about the source APIZipName is the name of the zip file containing the history from the FDJ api Type is the type of draw Version is the version of the draw for conversion Name is the name of the source
func GetSourceInfo ¶
func GetSourceInfo(source Source) SourceInfo
GetSourceInfo returns the source info for the given source If the source is not found, it returns the most recent source info the most recent source info is Loto201911 (from november 2019)