drivechecker

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: MIT Imports: 2 Imported by: 0

README

go-drive-checker

A Golang package to make drive checker app

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDriveState

func SetDriveState(storeID string, state *DriveState)

SetDriveState create a new state

Types

type DriveScrapper

type DriveScrapper interface {
	LoadDriveState(config StoreConfig) (hasChanged bool, err error)
}

DriveScrapper interface that defines func to get drive state

type DriveState

type DriveState struct {
	IsActive bool
	Dispo    string
}

DriveState struct to represent a store state

func GetDriveState

func GetDriveState(storeID string) *DriveState

GetDriveState get the state of a drive

type Retail

type Retail struct {
	Name string
	StoreScrapper
}

Retail struct to wrapp function of a drive

func (Retail) GetStoreIDByPostalCode

func (d Retail) GetStoreIDByPostalCode(postalCode string) ([]string, error)

GetStoreIDByPostalCode fetch storeIDs by postal code

type Store

type Store struct {
	ID   string
	Name string
	DriveScrapper
}

Store struct to represent a store data

func (Store) LoadIntervalDriveState

func (s Store) LoadIntervalDriveState(config StoreConfig, tick *time.Ticker, done chan bool)

LoadIntervalDriveState fetch each tick the drive state config

func (Store) NewDriveHandler

func (s Store) NewDriveHandler()

NewDriveHandler add a new drive handler

type StoreConfig

type StoreConfig struct {
	StoreID string
	State   *DriveState
}

StoreConfig struct reprsent a Store config

func NewStoreConfig

func NewStoreConfig(storeID string) StoreConfig

NewStoreConfig Create a new Store config with storeID

type StoreScrapper

type StoreScrapper interface {
	GetStoreById(storeID string) (Store, error)
	GetStoreByPostalCode(postalCode string) ([]Store, error)
	GetStoreIDByPostalCode(postalCode string) ([]string, error)
}

StoreScrapper interface to scrap a drive state and update config

Directories

Path Synopsis
cmd
api
pkg

Jump to

Keyboard shortcuts

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