facility

package
v0.0.0-...-de2618e Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFacilityMap

func CreateFacilityMap(dbs *sql.DB) (map[string]Facility, error)

CreateFacilityMap builds a map[string] based of array of facilities for search efficiency

func Delete

func Delete(dbs *sql.DB, name string) error

Delete removes facility based on name nolint :dupl

func Insert

func Insert(dbs *sql.DB, facilities *[]Facility, coefficients Coefficients) error

Insert receives a slice of Facility and coefficients defaults. if facility is not in the database, inserts facility with default coefficients if facility is in database, skip it.

func UpdateCoefficients

func UpdateCoefficients(dbs *sql.DB, facility Facility) error

Update receives a facility_id(name) and body to be updated in the facility collection

Types

type Coefficients

type Coefficients struct {
	// Percent of inventory that is sold daily
	DailyInventoryPercentage float64 `json:"dailyinventorypercentage" db:"dailyinventorypercentage"`
	// Probability of an unreadable tag becoming readable again each day (i.e. moved or retagged)
	ProbUnreadToRead float64 `json:"probunreadtoread" db:"probunreadtoread"`
	// Probability of a tag in the store being read by the overhead sensor each day
	ProbInStoreRead float64 `json:"probinstoreread" db:"probinstoreread"`
	// Probability of an exit error (missed 'departed' event) occurring
	ProbExitError float64 `json:"probexiterror" db:"probexiterror"`
}

Coefficients represents a set of attributes to calculate confidence

type CountType

type CountType struct {
	Count *int `json:"count"`
}

CountType represents a wrapper for count and inlinecount

func Retrieve

func Retrieve(dbs *sql.DB, query url.Values) (interface{}, *CountType, error)

Retrieve retrieves All facilities from database

type Facility

type Facility struct {
	// Facility name
	Name string `json:"name"  db:"name"`
	// The coefficients used in the probabilistic inventory algorithm
	Coefficients Coefficients `json:"coefficients"  db:"coefficients"`
}

Facility represents a facility model

func (*Facility) Scan

func (facility *Facility) Scan(value interface{}) error

Scan implements sql.Scanner interfaces

func (Facility) Value

func (facility Facility) Value() (driver.Value, error)

Value implements driver.Valuer interfaces

type RequestBody

type RequestBody struct {
	FacilityID               string  `json:"facility_id"`
	DailyInventoryPercentage float64 `json:"dailyinventorypercentage"`
	ProbUnreadToRead         float64 `json:"probunreadtoread"`
	ProbInStoreRead          float64 `json:"probinstoreread"`
	ProbExitError            float64 `json:"probexiterror"`
}

RequestBody represents a struct for the requestBody to Update facility collection

type Response

type Response struct {
	// Array containing results of query
	Results interface{} `json:"results"`
	// Count of records for query
	Count *int `json:"count,omitempty"`
}

Response is the model used to return the query response

Jump to

Keyboard shortcuts

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