caching

package
v0.0.0-...-35b36dc Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close gracefully closes the database

func CreateBucket

func CreateBucket(cacheFilename string)

CreateBucket adds the application bucket to the caching database

func ListPackages

func ListPackages()

ListPackages gets a list of packages from the database

func SetAppDb

func SetAppDb(db *bolt.DB)

SetAppDb sets the database for caching

Types

type DetailLog

type DetailLog struct {
	Date        string `json:"date"`
	Description string `json:"description"`
}

DetailLog represents a log of package movements

type OcaPackageDetail

type OcaPackageDetail struct {
	Data []struct {
		Type   string `json:"type"`
		Code   string `json:"code"`
		Detail []struct {
			Apellido           string   `json:"Apellido"`
			Calle              string   `json:"Calle"`
			CantidadPaquetes   string   `json:"CantidadPaquetes"`
			CodigoPostal       string   `json:"CodigoPostal"`
			CodigoPostalRetiro string   `json:"CodigoPostalRetiro"`
			Depto              struct{} `json:"Depto"`
			DeptoRetiro        struct{} `json:"DeptoRetiro"`
			DomicilioRetiro    string   `json:"DomicilioRetiro"`
			IDPieza            string   `json:"IdPieza"`
			Localidad          string   `json:"Localidad"`
			LocalidadRetiro    string   `json:"LocalidadRetiro"`
			Nombre             string   `json:"Nombre"`
			Numero             string   `json:"Numero"`
			NumeroEnvio        string   `json:"NumeroEnvio"`
			NumeroRetiro       string   `json:"NumeroRetiro"`
			PciaRetiro         string   `json:"PciaRetiro"`
			Piso               struct{} `json:"Piso"`
			PisoRetiro         struct{} `json:"PisoRetiro"`
			Provincia          string   `json:"Provincia"`
			Remito             string   `json:"Remito"`
		} `json:"detail"`
		Log []DetailLog `json:"log"`
	} `json:"data"`
	Success bool `json:"success"`
}

OcaPackageDetail represents the response from the OCA web service

func GetPackage

func GetPackage(code string) (*OcaPackageDetail, error)

GetPackage returns a single package by code

func (*OcaPackageDetail) DiffWith

func (p *OcaPackageDetail) DiffWith(packageDetails OcaPackageDetail) ([]DetailLog, bool)

DiffWith compares the structure of the package log with another package

func (*OcaPackageDetail) Save

func (p *OcaPackageDetail) Save() error

Save records a package details to the caching database

Jump to

Keyboard shortcuts

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